(()=>{function e(e){return e&&e.__esModule?e.default:e}var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},i={},a={},r=t.parcelRequire8d74;null==r&&((r=function(e){if(e in i)return i[e].exports;if(e in a){var t=a[e];delete a[e];var r={id:e,exports:{}};return i[e]=r,t.call(r.exports,r,r.exports),r.exports}var s=new Error("Cannot find module '"+e+"'");throw s.code="MODULE_NOT_FOUND",s}).register=function(e,t){a[e]=t},t.parcelRequire8d74=r),r.register("6rZxb",(function(e,t){!function(i,a){"use strict";var r="function",s="undefined",n="object",o="string",c="model",l="name",d="type",p="vendor",g="version",u="architecture",h="console",m="mobile",f="tablet",y="smarttv",b="wearable",w="embedded",v="Amazon",k="Apple",C="ASUS",S="BlackBerry",T="Firefox",P="Google",x="Huawei",D="LG",A="Microsoft",I="Motorola",_="Opera",M="Samsung",R="Sharp",N="Sony",E="Xiaomi",O="Zebra",U="Facebook",W=function(e){for(var t={},i=0;i0?2===c.length?typeof c[1]==r?this[c[0]]=c[1].call(this,d):this[c[0]]=c[1]:3===c.length?typeof c[1]!==r||c[1].exec&&c[1].test?this[c[0]]=d?d.replace(c[1],c[2]):a:this[c[0]]=d?c[1].call(this,d,c[2]):a:4===c.length&&(this[c[0]]=d?c[3].call(this,d.replace(c[1],c[2])):a):this[c]=d||a;p+=2}},B=function(e,t){for(var i in t)if(typeof t[i]===n&&t[i].length>0){for(var r=0;r350?L(e,350):e,this},this.setUA(r),this};j.VERSION="0.7.32",j.BROWSER=W([l,g,"major"]),j.CPU=W([u]),j.DEVICE=W([c,p,d,h,m,y,f,b,w]),j.ENGINE=j.OS=W([l,g]),typeof t!==s?(e.exports&&(t=e.exports=j),t.UAParser=j):typeof define===r&&define.amd?define((function(){return j})):typeof i!==s&&(i.UAParser=j);var F=typeof i!==s&&(i.jQuery||i.Zepto);if(F&&!F.ua){var H=new j;F.ua=H.getResult(),F.ua.get=function(){return H.getUA()},F.ua.set=function(e){H.setUA(e);var t=H.getResult();for(var i in t)F.ua[i]=t[i]}}}("object"==typeof window?window:this)})),r.register("lxtR3",(function(e,t){var i=r("2t0No");function a(){var e;try{e=t.storage.debug}catch(e){}return!e&&void 0!==i&&"env"in i&&(e=void 0),e}(t=e.exports=r("crKfB")).log=function(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)},t.formatArgs=function(e){var i=this.useColors;if(e[0]=(i?"%c":"")+this.namespace+(i?" %c":" ")+e[0]+(i?"%c ":" ")+"+"+t.humanize(this.diff),!i)return;var a="color: "+this.color;e.splice(1,0,a,"color: inherit");var r=0,s=0;e[0].replace(/%[a-zA-Z%]/g,(function(e){"%%"!==e&&(r++,"%c"===e&&(s=r))})),e.splice(s,0,a)},t.save=function(e){try{null==e?t.storage.removeItem("debug"):t.storage.debug=e}catch(e){}},t.load=a,t.useColors=function(){return!("undefined"==typeof window||!window.process||"renderer"!==window.process.type)||("undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))},t.storage="undefined"!=typeof chrome&&void 0!==chrome.storage?chrome.storage.local:function(){try{return window.localStorage}catch(e){}}(),t.colors=["lightseagreen","forestgreen","goldenrod","dodgerblue","darkorchid","crimson"],t.formatters.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}},t.enable(a())})),r.register("2t0No",(function(e,t){var i,a,r=e.exports={};function s(){throw new Error("setTimeout has not been defined")}function n(){throw new Error("clearTimeout has not been defined")}function o(e){if(i===setTimeout)return setTimeout(e,0);if((i===s||!i)&&setTimeout)return i=setTimeout,setTimeout(e,0);try{return i(e,0)}catch(t){try{return i.call(null,e,0)}catch(t){return i.call(this,e,0)}}}!function(){try{i="function"==typeof setTimeout?setTimeout:s}catch(e){i=s}try{a="function"==typeof clearTimeout?clearTimeout:n}catch(e){a=n}}();var c,l=[],d=!1,p=-1;function g(){d&&c&&(d=!1,c.length?l=c.concat(l):p=-1,l.length&&u())}function u(){if(!d){var e=o(g);d=!0;for(var t=l.length;t;){for(c=l,l=[];++p1)for(var i=1;i0)return function(e){if((e=String(e)).length>100)return;var t=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(e);if(!t)return;var o=parseFloat(t[1]);switch((t[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return o*n;case"days":case"day":case"d":return o*s;case"hours":case"hour":case"hrs":case"hr":case"h":return o*r;case"minutes":case"minute":case"mins":case"min":case"m":return o*a;case"seconds":case"second":case"secs":case"sec":case"s":return o*i;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return o;default:return}}(e);if("number"===l&&!1===isNaN(e))return t.long?o(c=e,s,"day")||o(c,r,"hour")||o(c,a,"minute")||o(c,i,"second")||c+" ms":function(e){return e>=s?Math.round(e/s)+"d":e>=r?Math.round(e/r)+"h":e>=a?Math.round(e/a)+"m":e>=i?Math.round(e/i)+"s":e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}}));let s;var n;let o;var c;let l;var d;let p;var g;let u;var h;let m;var f;let y;var b;let w;var v;let k;var C;let S;var T;let P;var x;let D;var A;let I;var _;let M;var R;let N;var E;let O;var U;let W;var q;let K;var L;let $;var B;let z;let V;var j;let F;var H;let G;var X;let J;var Z;let Y;var Q;let ee;var te;let ie;var ae;let re;var se;(n=s||(s={})).countdown="countdown",n.crisis="crisis",n.emailCapture="email-capture",n.fullScreen="full-screen",n.inPage="in-page",n.notifications="notifications",n.nudge="nudge",n.priceCheck="price-check",n.saveTheSearch="save-the-search",n.undercut="undercut",n.inline="inline",n.previewAssist="preview-assist",(c=o||(o={})).INFO="info",c.INFLUENCE="influence",c.REASSURANCE="reassurance",c.URGENCY="urgency",c.DISCOUNT="discount",c.MOBILE="mobile",c.CART_ABANDONMENT="cartAbandonment",c.DATA_COLLECTION="dataCollection",c.UNKNOWN="unknown",(d=l||(l={})).bookers="bookers",d.searchers="searchers",d.location="location",(g=p||(p={})).messageEngineWidgetData="tt_message_engine_widget_data",g.messageEngineShowWidget="tt_message_engine_show_widget",g.platformUpdate="tt_platform_update",g.saveTheSearchReady="tt_save_the_search_ready",g.emailCaptureReady="tt_email_capture_ready",g.nudgeReady="tt_nudge_ready",g.countdownReady="tt_countdown_ready",g.inPageReady="tt_in_page_ready",g.inlineReady="tt_inline_ready",g.previewAssistReady="tt_preview_assist_ready",g.undercutReady="tt_undercut_ready",g.priceCheckReady="tt_price_check_ready",g.notificationsReady="tt_notifications_ready",g.fullScreenReady="tt_full_screen_ready",g.crisisReady="tt_crisis_ready",g.forceFullScreenVisible="tt_force_full_screen_visible",g.messageDismiss="tt_message_dismiss",g.trackEventZappy="tt_track_event_zappy",g.trackEvent="tt_track_event",g.widgetDimensionsChange="tt_widget_dimensions_change",g.localStorageRequestItem="tt_local_storage_request_item",g.localStorageSetItem="tt_local_storage_set_item",g.localStorageRemoveItem="tt_local_storage_remove_item",g.localStorageItem="tt_local_storage_item",g.localStorageClear="tt_local_storage_clear",g.webShareAPIStatus="tt_web_share_api_status",g.optOutOfExperiments="tt_opt_out_of_experiments",g.captureGuestEmail="tt_capture_guest_email",g.shareSearchViaEmail="tt_share_search_via_email",g.emailRequestFinish="tt_email_request_finish",g.incomingPricingData="tt_incoming_pricing_data",g.clickedCopyToClipboard="tt_clicked_copy_to_clipboard",g.displayedMessage="tt_displayed_message",g.clickedMessageCTA="tt_clicked_message_cta",g.clickedMessageClose="tt_clicked_message_close",g.clickedMessageBody="tt_clicked_message_body",g.hoveredMessageBody="tt_hovered_message_body",(h=u||(u={})).messageRevealsKey="tt_message_engine_message_reveals",h.messageDismissesKey="tt_message_engine_message_dismisses",h.latestSearchKey="tt_message_engine_latest_search",h.latestVisitInfoKey="tt_message_engine_latest_visit_info",h.optOutOfExperiments="tt_message_engine_opt_out_of_experiments",(f=m||(m={})).abandonment="abandonment",f.opened="opened",f.closed="closed",f.notifications="notifications",f.notificationsOpen="open",f.notificationsClose="close",f.notificationsCloseButtonClick="close_button_click",f.notificationsTeaserClick="teaser_click",f.notificationsMouseEnter="mouse_enter",f.notificationsSearchersTooLow="searchers_too_low",f.messageEngine="messageEngine",f.load="load",f.messageAvailable="messageAvailable",f.placementSelector="placementSelector",f.propensityToConvert="propensityToConvert",f.priceCheck="spaceInvaders",f.priceCheckLoad="Load",f.priceCheckReveal="Reveal",f.priceCheckComplete="Widget Complete",f.priceCheckClick="Widget Clicked",f.priceCheckHover="Widget Hovered",f.priceCheckLayout="UpliftPriceCheck",(b=y||(y={})).top="top",b.left="left",b.right="right",b.full="full",b.background="background",(v=w||(w={})).self="_top",v.newTabOrWindow="_blank",(C=k||(k={})).FullImage="full-image",C.PriceCheck="price-check",C.Text="text",(T=S||(S={})).Button="button",T.CopyOnClick="copy-on-click",T.Share="share",T.None="none",(x=P||(P={})).None="none",x.FirstAndLastName="first-and-last-name",x.FullName="full-name",x.Title="title",x.ZipCode="zip-code",x.PhoneNumber="phone-number",(A=D||(D={})).Amiko="Amiko",A.BarlowCondensed="Barlow Condensed",A.Bitter="Bitter",A.Cabin="Cabin",A.Cinzel="Cinzel",A.CormorantGaramond="Cormorant Garamond",A.CrimsonText="Crimson Text",A.EBGaramond="EB Garamond",A.Glegoo="Glegoo",A.Hind="Hind",A.Lato="Lato",A.Lora="Lora",A.Montserrat="Montserrat",A.MontserratAlternates="Montserrat Alternates",A.Muli="Muli",A.NoticiaText="Noticia Text",A.OpenSans="Open Sans",A.Oswald="Oswald",A.PTSans="PT Sans",A.PetitFormalScript="Petit Formal Script",A.PlayfairDisplay="Playfair Display",A.Poppins="Poppins",A.Quicksand="Quicksand",A.Raleway="Raleway",A.Roboto="Roboto",A.Signika="Signika",A.SourceSerifPro="Source Serif Pro",A.Ubuntu="Ubuntu",A.Volkhov="Volkhov",A.WorkSans="Work Sans",(_=I||(I={})).rounded="rounded",_.square="square",(R=M||(M={})).rounded="rounded",R.pill="pill",R.square="square",(E=N||(N={})).UNDERCUT="undercut",E.PARITY="in_parity",E.CHEAPER_DIRECT="cheaper_direct",(U=O||(O={})).inXDays="inXDays",U.afterXDays="afterXDays",U.compoundBetween="compoundBetween",U.compoundDurations="compoundDurations",U.daysOfWeek="daysOfWeek",U.referrers="referrers",U.tripteaseChannels="tripteaseChannels",U.newVsReturning="newVsReturning",U.urlInclusions="urlInclusions",U.urlExclusions="urlExclusions",U.locations="locations",U.likelihoodToConvert="likelihoodToConvert",U.partySize="partySize",U.deviceType="deviceType",U.webTraffic="webTraffic",U.metaParityStatus="metaParityStatus",U.pageTypes="pageTypes",U.userTypes="userTypes",U.availabilityStatus="availabilityStatus",(q=W||(W={})).mobile="mobile",q.desktop="desktop",(L=K||(K={})).Unknown="Unknown",L.RoomsAndRates="RoomsAndRates",L.Confirmation="Confirmation",(B=$||($={})).Member="member",B.NonMember="non-member",(z||(z={})).NoAvailability="NoAvailability",(j=V||(V={})).COUNTRY="Country",j.REGION="Region",j.CITY="City",(H=F||(F={})).individual="individual",H.couple="couple",H.family="family",H.group="group",(X=G||(G={})).High="high",X.Low="low",X.Undetermined="undetermined",(Z=J||(J={})).Room="Room",Z.Fee="Fee",Z.Tax="Tax",Z.Unknown="Unknown",(Q=Y||(Y={})).bestDirect="bestDirect",Q.allUndercut="allUndercut",Q.unknown="unknown",(te=ee||(ee={})).load="load",te.events="events",(ae=ie||(ie={})).abandonment="abandonment",ae.messageEngine="messageEngine",(se=re||(re={})).Config="triptease.config",se.Navigation="triptease.navigation";const ne=["clientName","pageType","pageUrl","userAgent","userId","sessionId","pageVisitId"],oe=(e,t)=>{for(const i of ne)if(!e[i])return t.info(`Not enough external state to run, missing property ${i}`),!1;return e.clientKey||e.apiKey?!!(e.pageType!==K.RoomsAndRates||e.search&&e.search.checkin&&e.search.checkout)||(t.info("Not enough external state to run, as we are on rooms and rates page, but do not have checkin and checkout data"),!1):(t.info("Not enough external state to run, we need either a clientKey or an apiKey"),!1)},ce=(e,t,i)=>{if(e===t)return!0;if(le(e)&&le(t))return e===t;if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let a in e)if(a!==i){if(!(a in t))return!1;if(!ce(e[a],t[a]))return!1}return!0},le=e=>e!==Object(e),de=(e,t)=>{if(!t)return!0;const i={...e,onboardEventId:void 0},a={...t,onboardEventId:void 0};return!ce(i,a)},pe=e=>{if(!e.apiKey&&!e.clientKey)throw Error("No apiKey or clientKey so message-engine can't execute");return{key:e.apiKey||e.clientKey,version:20250827080428}},ge=(e,t,i,a,r,s,n,o,c)=>({key:e.key,version:e.version,countryCode:n,regionCode:o,city:c,latestVisitInfo:t,messageReveals:i,messageDismisses:a,latestSearch:r,isMobile:s});var ue,he,me={},fe="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof window.msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto);if(fe){var ye=new Uint8Array(16);me=function(){return fe(ye),ye}}else{var be=new Array(16);me=function(){for(var e,t=0;t<16;t++)0==(3&t)&&(e=4294967296*Math.random()),be[t]=e>>>((3&t)<<3)&255;return be}}for(var we,ve,ke={},Ce=[],Se=0;Se<256;++Se)Ce[Se]=(Se+256).toString(16).substr(1);ke=function(e,t){var i=t||0,a=Ce;return[a[e[i++]],a[e[i++]],a[e[i++]],a[e[i++]],"-",a[e[i++]],a[e[i++]],"-",a[e[i++]],a[e[i++]],"-",a[e[i++]],a[e[i++]],"-",a[e[i++]],a[e[i++]],a[e[i++]],a[e[i++]],a[e[i++]],a[e[i++]]].join("")};var Te=0,Pe=0;he=function(e,t,i){var a=t&&i||0,r=t||[],s=(e=e||{}).node||we,n=void 0!==e.clockseq?e.clockseq:ve;if(null==s||null==n){var o=me();null==s&&(s=we=[1|o[0],o[1],o[2],o[3],o[4],o[5]]),null==n&&(n=ve=16383&(o[6]<<8|o[7]))}var c=void 0!==e.msecs?e.msecs:(new Date).getTime(),l=void 0!==e.nsecs?e.nsecs:Pe+1,d=c-Te+(l-Pe)/1e4;if(d<0&&void 0===e.clockseq&&(n=n+1&16383),(d<0||c>Te)&&void 0===e.nsecs&&(l=0),l>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");Te=c,Pe=l,ve=n;var p=(1e4*(268435455&(c+=122192928e5))+l)%4294967296;r[a++]=p>>>24&255,r[a++]=p>>>16&255,r[a++]=p>>>8&255,r[a++]=255&p;var g=c/4294967296*1e4&268435455;r[a++]=g>>>8&255,r[a++]=255&g,r[a++]=g>>>24&15|16,r[a++]=g>>>16&255,r[a++]=n>>>8|128,r[a++]=255&n;for(var u=0;u<6;++u)r[a+u]=s[u];return t||ke(r)};var xe;var De=xe=function(e,t,i){var a=t&&i||0;"string"==typeof e&&(t="binary"===e?new Array(16):null,e=null);var r=(e=e||{}).random||(e.rng||me)();if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,t)for(var s=0;s<16;++s)t[a+s]=r[s];return t||ke(r)};De.v1=he,De.v4=xe,ue=De;var Ae={environment:"production",saveTheSearchSrc:"https://targeted-messages.triptease.io/static/savethesearch.html",nudgeSrc:"https://targeted-messages.triptease.io/static/nudge.html",countdownSrc:"https://targeted-messages.triptease.io/static/countdown.html",undercutSrc:"https://targeted-messages.triptease.io/static/undercut.html",priceCheckSrc:"https://targeted-messages.triptease.io/static/pricecheck.html",notificationsSrc:"https://targeted-messages.triptease.io/static/notifications.html",fullScreenSrc:"https://targeted-messages.triptease.io/static/fullscreen.html",crisisSrc:"https://targeted-messages.triptease.io/static/crisis.html",inlineSrc:"https://targeted-messages.triptease.io/static/inline.html",inPageSrc:"https://targeted-messages.triptease.io/static/inpage.html",emailCaptureSrc:"https://targeted-messages.triptease.io/static/emailcapture.html",previewAssistSrc:"https://targeted-messages.triptease.io/static/previewassist.html",storageIframeSrc:"https://targeted-messages.triptease.io/static/storageIframe.html",campaignServiceUrl:"https://messages.guest-experience.triptease.io",priceCheckApiUrl:"https://price-check.pf.triptease.io",zappyUrl:"https://api.triptease.io/zappy"};async function Ie(e){const t=await fetch(e.url,{method:e.method||"GET",headers:e.headers,body:e.body});return{status:t.status,headers:Me(t.headers),body:await t.text()}}function _e({method:e="POST",url:t,body:i}){const a=JSON.stringify(i);if(void 0!==navigator.sendBeacon&&"POST"===e)navigator.sendBeacon(t,a);else if("undefined"!=typeof fetch)return fetch(t,{method:e,body:a})}function Me(e){let t={};for(let i of e.entries()){const[e,a]=i;t[e]=a}return t}class Re{constructor(e,t){this.externalState=e,this.initialInternalState=t}track(t){const i={eventName:t.eventName,eventAppName:t.eventAppName};return _e({url:`${Ae.zappyUrl}/event?${Ne(i)}`,body:{eventType:"AppEvent",value:{...t,eventId:e(ue).v4(),createdTime:new Date,userAgent:this.externalState.userAgent,userId:this.externalState.userId,sessionId:this.externalState.sessionId,pageVisitId:this.externalState.pageVisitId,clientName:this.externalState.clientName,version:this.initialInternalState.version}}})}}const Ne=e=>Object.keys(e).map((t=>`${t}=${encodeURIComponent(e[t])}`)).join("&"),Ee=({eventName:t,eventAppName:i,payload:a})=>({eventType:"AppEvent",value:{...a,eventName:t,eventAppName:i,eventId:e(ue).v4(),createdTime:new Date,userAgent:navigator.userAgent,campaignType:a.messageType,campaignId:a.messageId}}),Oe=({eventName:e,eventAppName:t,payload:i})=>_e({url:`${Ae.zappyUrl}/event?${Ne({eventName:e,eventAppName:t})}`,body:Ee({eventName:e,eventAppName:t,payload:i})}),Ue=e=>{const t={eventName:e.map((e=>e.eventName)).join(",")};return _e({url:`${Ae.zappyUrl}/event?${Ne(t)}`,body:e.map((e=>Ee(e)))})};function We(e){return{adults:e.adults,children:e.children,checkin:e.checkin,checkout:e.checkout,rooms:e.rooms}}function qe(e){return{...We(e),rateDetails:(e.rateDetails||[]).map((e=>({price:e.price,currency:e.currency.toUpperCase(),rateName:e.rateName,rateCode:e.rateCode,roomName:e.roomName,roomCode:e.roomCode,basePrice:e.basePrice,rooms:e.rooms,tags:e.tags,adults:e.adults,children:e.children,priceComponents:e.priceComponents}))),priceComponents:e.priceComponents,total:e.total,promoCodes:e.promoCodes,allowedRates:e.allowedRates,excludedRates:e.excludedRates,allowedPromoCodes:e.allowedPromoCodes,ratesModified:e.ratesModified}}function Ke(e){return e.type===K.RoomsAndRates}const Le=e=>{const t=e.payload,i=function(e,t){return{language:e.language||t.page.locale||t.locale,referrer:t.page.referrer,pageUrl:t.page.url,pageTitle:t.page.title,userAgent:t.userAgent}}(t,e.context),a=function(e){return{userId:e.userId,sessionId:e.sessionId,pageVisitId:e.pageVisitId,anonymousId:e.anonymousId}}(e),r={...i,...a,onboardEventId:e.messageId,appName:e.context.app?.name,applications:e.applications,clientKey:t.clientKey,clientName:t.clientName,pageType:t.type||K.Unknown,userTypes:t.userTypes||[],apiKey:t.apiKey,hotelName:t.hotelName,priceCheckData:Ke(t)?qe(t):void 0,search:Ke(t)?We(t):void 0,isPreview:i.pageUrl.indexOf("tt_preview")>-1};if(!Ke(s=t)||!Array.isArray(s.rateDetails))return r;var s,n;if(n=t.rateDetails,Array.isArray(n)&&new Set(n.map((e=>e.apiKey))).size>1){const e=t.rateDetails.sort(((e,t)=>e.price-t.price))[0];return{...r,apiKey:e.apiKey,hotelName:e.hotelName,search:We(t),priceCheckData:qe({...t,priceComponents:e.priceComponents||t.priceComponents,rateDetails:[e]})}}return{...r,search:We(t),priceCheckData:qe(t)}};function $e(e){return!!(e.userAgent||"").match(/Mobile|iP(hone|od|ad)|Android|BlackBerry|IEMobile|Kindle|NetFront|Silk-Accelerated|(hpw|web)OS|Fennec|Minimo|Opera M(obi|ini)|Blazer|Dolfin|Dolphin|Skyfire|Zune/)}class Be{constructor(e,t){this.storageIframe=e,this._window=t,this.storageIframe=e,this._window=t}async webShareAPIAvailable(){try{const e=await this.sendToLocalStorage(p.webShareAPIStatus);return"boolean"==typeof e&&e}catch(e){return!1}}async isAvailable(){const e="test-key",t="test-value";try{await this.set(e,t);const i=await this.get(e);return await this.remove(e),i===t}catch(e){return!1}}async set(e,t){const i=p.localStorageSetItem;await this.sendToLocalStorage(i,{key:e,value:t})}async get(e){const t=p.localStorageRequestItem,i=await this.sendToLocalStorage(t,{key:e});return i?String(i):void 0}async remove(e){const t=p.localStorageRemoveItem;await this.sendToLocalStorage(t,{key:e})}async clearAll(){const e=p.localStorageClear;await this.sendToLocalStorage(e)}isLocalStorageMessageResponse(e,t,i){return!(!this.storageIframe||this.storageIframe.contentWindow!==e.source||!e.data||e.data.type!==t||void 0!==i&&e.data.payload.key!==i)}async sendToLocalStorage(e,t){if(this.storageIframe&&this.storageIframe.contentWindow)return this.storageIframe.contentWindow.postMessage({type:e,payload:t},"*"),new Promise((i=>{const a=r=>{this.isLocalStorageMessageResponse(r,e,t&&t.key)&&(this._window.removeEventListener("message",a),i(r.data.payload&&r.data.payload.value))};this._window.addEventListener("message",a)}))}}function ze(...e){const t={...e[0]};let i=0;for(;ize(a[t],r[t],e))))}}function Fe(e){return!("object"!=typeof e||null==e||e instanceof Date||Array.isArray(e))}function He(e,t,i){return i===s.notifications?`${t}-${e}`:`${i}-${t}`}async function Ge(e,t){try{if(await e.isAvailable()){const i=await e.get(t);return i&&JSON.parse(i)||{}}return{}}catch(e){return{}}}class Xe{constructor(e,t){this.localStorage=e,this.apiKey=t}async getMessageDismisses(){return await Ge(this.localStorage,u.messageDismissesKey)}async getMessageReveals(){return await Ge(this.localStorage,u.messageRevealsKey)}async updateMessageDismisses(e,t){const i=await this.getMessageDismisses(),a=He(this.apiKey,e,t);await this.localStorage.set(u.messageDismissesKey,JSON.stringify(Ve(i,{[a]:Date.now()})))}async updateMessageReveals(e,t){const i=await this.getMessageReveals(),a=He(this.apiKey,e,t);await this.localStorage.set(u.messageRevealsKey,JSON.stringify(Ve(i,{[a]:Date.now()})))}}var Je=async function({apiKey:e,config:t=Ae,logger:i,language:a}){const r=new URL(`${t.campaignServiceUrl}/${e}/messages`);"triptease-test-react3"===e&&r.searchParams.set("force-cloud-run","true"),a&&r.searchParams.set("language",a);const s=await Ie({url:r.href});if(s.status>=200&&s.status<300){const e=s.headers["x-country-code"],t=s.headers["x-region-code"],a=s.headers["x-city"],r=JSON.parse(s.body),n={countryCode:e,regionCode:t?`${e}-${t}`:null,city:t&&a?`${e}-${t}-${a}`:null,messages:r.messages,notifications:r.notifications,...r};return i.info("Loaded messages:",n),n}return{messages:[],notifications:{}}};function Ze(e){return e.toISOString().split("T")[0]}function Ye(e){return e.getFullYear().toString()}function Qe(e){return tt(e.getMonth()+1)}function et(e){return tt(e.getDate())}function tt(e){return`${e}`.padStart(2,"0")}function it(e,t){return(t.getTime()-e.getTime())/864e5}function at(e,t){return it(new Date(e),new Date(t))}function rt(e){return Math.ceil(it(new Date,e))}function st(e,t){return e-t>18e5}function nt(e,t){return!!e&&(e.isReturningVisitor||st(t,e.lastSeen))}function ot(e,t){return e?st(t,e.lastSeen)?1:++e.pageViews:1}function ct(e){const{adults:t=0,children:i=0,checkin:a,checkout:r}=e;return[t,i,Ze(a),Ze(r)].join(":")}function lt(e,t,i){return i?{...e&&e.priceQueries,[ct(i)]:t}:e&&e.priceQueries}function dt(e,t){if(t)return Object.entries(t).reduce(((t,[i,a])=>(function(e,t){return e-t>288e5}(e,a)||(t[i]=a),t)),{})}var pt=async function({apiKey:e,localStorage:t,currentTimestamp:i,search:a}){const r=await t.get(u.latestVisitInfoKey),s=r?JSON.parse(r):{},n=s&&s[e],o={isReturningVisitor:nt(n,i),firstSeen:n&&n.firstSeen||i,lastSeen:i,pageViews:ot(n,i),priceQueries:dt(i,lt(n,i,a))};return await t.set(u.latestVisitInfoKey,JSON.stringify({...s,[e]:o})),o};var gt=async(e,t,i)=>{if(i)return e.set(u.latestSearchKey,JSON.stringify({[t]:i})),i;const a=(await Ge(e,u.latestSearchKey))[t];return a?{checkout:new Date(a.checkout),checkin:new Date(a.checkin),adults:Number(a.adults),children:Number(a.children)}:null},ut=r("6rZxb");const ht=(e,t,i)=>t.map(((t,a)=>e(t,i[a])));var mt=({searchCount:e,browserName:t})=>{const i=Math.sqrt(4.51519294),a=(e=>e.reduce(((e,t)=>e+t),0))(ht(((e,t)=>e*t),[.43647949,.56805652],["Chrome"===t?1:0,(e-2.49051756)/i]))+-.3574456061541282;const r=1/(1+Math.exp(-a));return Math.floor(100*r)/100};var ft=class{constructor(e,t){this.version=2;const i=Object.keys(e.latestVisitInfo.priceQueries||{}).length;if(i<=1)this.likelihoodBucket=G.Undetermined;else{const e=new(0,ut.UAParser)(t.userAgent);this.probabilityScore=mt({searchCount:i,browserName:e.getBrowser().name}),this.likelihoodBucket=this.probabilityScore>=.6?G.High:G.Low}this.track(e,t)}track(e,t){Oe({eventName:m.propensityToConvert,eventAppName:m.messageEngine,payload:{apiKey:e.key,userId:t.userId,sessionId:t.sessionId,pageVisitId:t.pageVisitId,clientName:t.clientName,ptcVersion:this.version,bucket:this.likelihoodBucket,probabilityScore:this.probabilityScore}})}};function yt(e){const t=wt(e);return-1!==t.indexOf("tt_meta=google")||-1!==t.indexOf("tt_meta=gha")}const bt=(e,t)=>{if(e.criteria.locations){if(t.city){if(e.criteria.locations.filter((e=>e.exclude&&e.code===t.city)).length)return!1}if(t.regionCode){const i=!e.criteria.locations.some((e=>e.code===t.city));if(e.criteria.locations.filter((e=>e.exclude&&e.code===t.regionCode&&i)).length)return!1}if(t.countryCode){const i=!e.criteria.locations.some((e=>e.code===t.regionCode));if(e.criteria.locations.filter((e=>e.exclude&&e.code===t.countryCode&&i)).length)return!1}return!e.criteria.locations.filter((e=>!e.exclude)).length||e.criteria.locations.filter((e=>!e.exclude)).some((e=>{switch(e.type){case V.COUNTRY:return e.code===t.countryCode;case V.REGION:return e.code===t.regionCode;case V.CITY:return e.code===t.city}}))}return!0},wt=e=>e?e.toLowerCase().replace(/\s/g,"").replace(/https?:\/\//,"").replace(/www\./,"").replace(/\/$/,""):"",vt={[O.compoundBetween]:(e,t,i,a)=>{if(e.criteria.checkInDates&&e.criteria.checkInDates.compoundBetween&&t.latestSearch){const i=t.latestSearch.checkin.toISOString().split("T")[0];return e.criteria.checkInDates.compoundBetween.some((e=>i>=e.start.split("T")[0]&&i<=e.end.split("T")[0]))}return!0},[O.inXDays]:(e,t,i,a)=>{if(e.criteria.checkInDates&&e.criteria.checkInDates.inXDays&&t.latestSearch){const i=rt(t.latestSearch.checkin);return i>=0&&i<=parseInt(e.criteria.checkInDates.inXDays,10)}return!0},[O.afterXDays]:(e,t,i,a)=>{if(e.criteria.checkInDates&&e.criteria.checkInDates.afterXDays&&t.latestSearch){const i=rt(t.latestSearch.checkin),a=e.criteria.checkInDates.afterXDays;return a.end?i>=parseInt(a.start,10)&&i<=parseInt(a.end,10):i>=parseInt(a.start,10)}return!0},[O.compoundDurations]:(e,t,i,a)=>{if(e.criteria.checkInDates&&e.criteria.checkInDates.compoundDurations&&t.latestSearch){const{checkin:i,checkout:a}=t.latestSearch,r=at(i,a),s=e.criteria.checkInDates.compoundDurations,n=e.criteria.checkInDates.compoundDurations.map((e=>parseInt(e,10))).filter((e=>!!e)),o=n[n.length-1];return">"===s[s.length-1]&&o<=r||-1!==n.indexOf(r)}return!0},[O.daysOfWeek]:(e,t,i,a)=>{if(e.criteria.checkInDates&&e.criteria.checkInDates.daysOfWeek&&t.latestSearch){const i=t.latestSearch.checkin.getUTCDay();return e.criteria.checkInDates.daysOfWeek.indexOf(i)>-1}return!0},[O.referrers]:(e,t,i,a)=>!e.criteria.referrers||e.criteria.referrers.some((e=>wt(i.referrer).indexOf(wt(e))>-1)),[O.tripteaseChannels]:(e,t,i,a)=>!e.criteria.tripteaseChannels||e.criteria.tripteaseChannels.some((e=>wt(i.pageUrl).indexOf(wt(e))>-1)),[O.metaParityStatus]:(e,t,i,a)=>!e.criteria.metaParityStatus||yt(i.pageUrl),[O.newVsReturning]:(e,t,i,a)=>{if(e.criteria.newVsReturning){return"returning"===e.criteria.newVsReturning===t.latestVisitInfo.isReturningVisitor}return!0},[O.urlInclusions]:(e,t,i,a)=>!e.criteria.urlInclusions||e.criteria.urlInclusions.some((({matcherType:e,value:t})=>"equals"===e?wt(i.pageUrl)===wt(t):wt(i.pageUrl).indexOf(wt(t))>-1)),[O.urlExclusions]:(e,t,i,a)=>!e.criteria.urlExclusions||e.criteria.urlExclusions.every((({matcherType:e,value:t})=>"equals"===e?wt(i.pageUrl)!==wt(t):-1===wt(i.pageUrl).indexOf(wt(t)))),[O.locations]:(e,t)=>bt(e,t),[O.likelihoodToConvert]:(e,t,i,a)=>!e.criteria.likelihoodToConvert||e.criteria.likelihoodToConvert===a.likelihoodBucket,[O.webTraffic]:(e,t,i,a)=>!e.criteria.webTraffic||e.criteria.webTraffic.countryCode===t.countryCode,[O.partySize]:(e,t,i,a)=>{if(e.criteria.partySize){if(!t.latestSearch||void 0===t.latestSearch.adults)return!1;const i=+(t.latestSearch.adults||0),a=+(t.latestSearch.children||0);switch(e.criteria.partySize){case"individual":return 1===i&&0===a;case"couple":return 2===i&&0===a;case"family":return i>=1&&a>=1;case"group":return i>=3}}return!0},[O.deviceType]:(e,t,i,a)=>!e.criteria.deviceType||(e.criteria.deviceType===W.mobile?t.isMobile:!t.isMobile),[O.pageTypes]:(e,t,i,a)=>Array.isArray(e.criteria.pageTypes)?e.criteria.pageTypes.some((e=>i.pageType===e)):i.pageType!==K.Confirmation,[O.userTypes]:(e,t,i,a)=>!Array.isArray(e.criteria.userTypes)||e.criteria.userTypes.some((e=>i.userTypes?.includes(e))),[O.availabilityStatus]:(e,t,i,a)=>!e.criteria.availabilityStatus||e.criteria.availabilityStatus===z.NoAvailability&&i.pageType===K.RoomsAndRates&&"noAvailability"===i.priceCheckData?.ratesModified},kt={now:()=>new Date},Ct=({internalState:e,externalState:t,message:i,likelihoodToConvert:a,logger:r,clock:s=kt})=>{if(i.criteria.checkInDates&&!e.latestSearch)return r.info(`Message ${i.id} (${i.type}) - some criteria not valid: check-in date present but there has not been a search`),r.diagnostics.onlyShowsOnBookingEngine(i),!1;const n=Object.entries(vt).filter((([,r])=>!r(i,e,t,a,s))).map((([e])=>e)),o=0===n.length;return o?r.info(`Message ${i.id} (${i.type}) - all criteria validated`):(r.diagnostics.criteriaNotFulfilled(i,i.criteria,n),r.info(`Message ${i.id} (${i.type}) - some criteria not valid: ${n}`)),o},St=[O.compoundBetween,O.inXDays,O.afterXDays,O.compoundDurations,O.daysOfWeek],Tt=[O.referrers,O.urlInclusions,O.urlExclusions,O.locations,O.newVsReturning,O.likelihoodToConvert,O.partySize,O.deviceType,O.userTypes,O.tripteaseChannels,O.metaParityStatus,O.availabilityStatus],Pt=[O.userTypes,O.metaParityStatus,O.tripteaseChannels,O.likelihoodToConvert,O.newVsReturning,O.locations,O.referrers,O.urlInclusions,O.compoundBetween,O.inXDays,O.afterXDays,O.compoundDurations,O.daysOfWeek,O.urlExclusions,O.partySize,O.deviceType],xt=e=>{let t=[];return e.criteria.checkInDates&&(t=t.concat(Object.keys(e.criteria.checkInDates).filter((e=>St.indexOf(e)>-1)))),t=t.concat(Object.keys(e.criteria).filter((e=>Tt.indexOf(e)>-1))),t.sort(((e,t)=>Pt.indexOf(e)-Pt.indexOf(t))),t};function Dt(e,t){const i=xt(e),a=xt(t);if(i.length!==a.length)return a.length-i.length;const[r,s]=((e,t)=>{const i=e.filter((e=>-1===t.indexOf(e)))[0];return i?[i,t.filter((t=>-1===e.indexOf(t)))[0]]:[]})(i,a);return((e,t)=>Pt.indexOf(e)-Pt.indexOf(t))(r,s)}var At=r("lxtR3");class It{isActive(){return!1}seenTooRecently(){}addMessages(){}addHandledMessageTypes(){}criteriaNotFulfilled(){}lowerPriorityCriteria(){}messageTypeNotHandled(){}onlyShowsOnBookingEngine(){}excludedDueToOverlap(){}shouldShow(){}disabledDueToMetaLandingPageAndMemberRate(){}flush(){}sendPricingApiResult(){}}const _t=e=>JSON.parse(JSON.stringify(e));class Mt{constructor(){this.eventsByMessageId={},this.metadataByMessageId={},this.handledMessageTypes=[],this.environment={}}disabledDueToMetaLandingPageAndMemberRate(e){this.addEvent("disabledDueToMetaLandingPageAndMemberRate",[e.id],{[e.id]:{name:e.name,type:e.type}})}isActive(){return!0}shouldShow(e){this.addEvent("shouldShow",[e.id],{[e.id]:{name:e.name,type:e.type}})}seenTooRecently(e,t){this.addEvent("seenTooRecently",[e.id],{[e.id]:{...t,name:e.name}})}onlyShowsOnBookingEngine(e){this.addEvent("onlyShowsOnBookingEngine",[e.id],{[e.id]:{name:e.name,type:e.type}})}excludedDueToOverlap(e){this.addEvent("overlapsWithHigherPriorityMessage",e.map((({id:e})=>e)),e.reduce(((e,t)=>({...e,[t.id]:{name:t.name,type:t.type}})),{}))}lowerPriorityCriteria(e,t){this.addEvent("lowerPriorityCriteria",t.map((e=>e.id)),t.reduce(((e,t)=>({...e,[t.id]:{name:t.name,type:t.type}})),{}))}messageTypeNotHandled(e){this.addEvent("messageTypeNotHandled",e.map((e=>e.id)),e.reduce(((e,t)=>({...e,[t.id]:{name:t.name,type:t.type}})),{}))}addHandledMessageTypes(e,t){this.handledMessageTypes.push(...e),this.environment=t}addMessages(e){e.forEach((e=>{this.metadataByMessageId[e.id]={name:e.name,type:e.type}}))}ensure(e){return this.eventsByMessageId[e]||(this.eventsByMessageId[e]=[]),this.eventsByMessageId[e]}criteriaNotFulfilled(e,t,i){this.addEvent("criteriaNotFulfilled",[e.id],{[e.id]:{invalidPredicates:i,criteria:t,name:e.name,type:e.type}})}addEvent(e,t,i){t.forEach((t=>{const a=i&&Object.keys(i).find((e=>e===t))?i[t]:i;this.ensure(t).push({event:e,additionalInformation:i&&a})}))}flush(){const e={messages:_t(this.eventsByMessageId),handledTypes:{types:this.handledMessageTypes,environment:this.environment},messageMetadata:this.metadataByMessageId};this.eventsByMessageId={},window.postMessage({type:"triptease.message-engine.diagnostics",payload:e},"*")}sendPricingApiResult(e){const t=_t(e);window.postMessage({type:"triptease.message-engine.price-check",payload:t})}}const Rt=()=>{try{return localStorage.debug?.startsWith("message-engine")||!1}catch(e){return!1}};let Nt;function Et(t="message-engine"){return Nt||(Nt=function(e,t){return{diagnostics:Rt()?new Mt:new It,log:e(`${t}:log`),info:e(`${t}:info`),warn:e(`${t}:warn`),error:e(`${t}:error`)}}(e(At),t)),Nt}const Ot=864e5,Ut=Ot;function Wt(e,t,i,a){const{key:r,messageReveals:s}=i,n=He(r,t,e);return Boolean(s&&s[n]&&Date.now()-s[n]>6e4&&Date.now()-s[n]=jt;)e/=2,t/=2,i>>>=1;return(e+i)/t}}).resetGlobal=function(){Math.random=Ht},Jt(Math.random(),$t);var Qt=(t,i)=>{const{variants:a,...r}=t,s=1===a.length?a[0]:((t,i)=>e(Kt)(i)()<.5?t[0]:t[1])(a,i);return{...r,...s}};const ei=({messageType:e,messages:t,internalState:i,externalState:a,likelihoodToConvert:r,userId:s,logger:n})=>{const o=t.map((e=>Qt(e,s))).filter((t=>t.type===e&&Ct({message:t,internalState:i,externalState:a,likelihoodToConvert:r,logger:n})&&qt(e,{name:t.name,messageId:t.id},i))).sort(Dt);if(!o.length)return null;const[c,...l]=o;return n.info(`Valid messages for type ${e}:`,o),n.diagnostics.lowerPriorityCriteria(c,l),c},ti=[];function ii({messagePerType:e,apiKey:t,trackingEnrichment:i}){const a=Object.entries(e).filter((([,e])=>!!e)).filter((([,e])=>ti.indexOf(e.id)<0)).map((([e,a])=>a&&{eventAppName:m.messageEngine,eventName:m.messageAvailable,payload:{...i,apiKey:t,messageType:e,messageId:a.id}})).filter((e=>!!e));a.length&&(Ue(a),a.forEach((e=>ti.push(e.payload.messageId))))}let ai,ri,si=[],ni=!1,oi=[];function ci(e,t){document.addEventListener(e,t),oi.push({eventName:e,handler:t})}const li=e=>{if(!ni){const e=e=>{si.forEach((t=>{t(e)})),si=[],oi.forEach((({eventName:e,handler:t})=>document.removeEventListener(e,t))),window.clearTimeout(ai),window.clearTimeout(ri),oi=[],ni=!1};di(e),pi(e),gi(e),ni=!0}si.push(e)},di=e=>{let t,i=!1;ci("keydown",(a=>{a.ctrlKey||a.metaKey?(i=!0,t=window.setTimeout((()=>{i&&e("keyDown")}),500)):(i=!1,window.clearTimeout(t))})),ci("keyup",(e=>{e.ctrlKey||e.metaKey||(i=!1,window.clearTimeout(t))}))},pi=e=>{function t(){window.clearTimeout(ai),ai=window.setTimeout((()=>e("onIdle")),6e4)}t(),ci("mousemove",t),ci("scroll",t),ci("keypress",t)},gi=e=>{ci("mouseout",(t=>{t.clientY<2&&null===t.relatedTarget&&(ri=window.setTimeout((()=>{e("onMouseLeave")}),335))})),ci("mousemove",(e=>{e.clientY>=2&&window.clearTimeout(ri)}))},ui=[],hi=[{name:"synxis",createDeepLink:(e,t)=>{const{hostname:i,searchParams:a}=new URL(e),r=a.get("chain")||a.get("Chain"),s=a.get("hotel")||a.get("Hotel"),n=a.get("promo")||void 0,o=a.get("currency")||"USD",c=new URLSearchParams({arrive:[Ye(t.checkin),Qe(t.checkin),et(t.checkin)].join("-"),depart:[Ye(t.checkout),Qe(t.checkout),et(t.checkout)].join("-"),adult:String(t.adults),child:String(t.children),rooms:"1",...r?{chain:r}:{},...s?{hotel:s}:{},...n?{promo:n}:{},level:"hotel",start:"availresults",locale:"en-US",currency:o}),l=new URL(`https://${i}`);return l.search=c.toString(),l.href},testUrl:e=>/gc\.synxis\.com/.test(e)||/be\.synxis\.com/.test(e)||/chain=\d+/.test(e)&&/hotel=\d+/.test(e)}];function mi(e,t,i){try{const i=new URL(function(e,t){const i=hi.filter((t=>t.testUrl(e)));return i.length>=1&&i[0]?i[0].createDeepLink(e,t):e}(e,t));return i.searchParams.set("tt_channel","savesearch"),i.href}catch(e){i.error(e)}return e}function fi({hotelName:e,pageTitle:t,pageUrl:i,search:a},r){const s=a?mi(i,a,r):i,n=e||t||"",o=function(e,t){return[e,t?.checkin?.toDateString(),t?.checkout?.toDateString(),t?.adults,t?.children].filter((e=>!!e)).join(" | ")}(n,a);return{title:n,text:o,url:s}}let yi;let bi;let wi;var vi;function ki(e,t){window.postMessage({type:"triptease.event",event:e,context:{app:{name:"MessageEngine",version:20250827080428}},payload:t},"*")}function Ci(e,t,i){const{availabilityStatus:a,...r}=t;ki(wi.UserSubmittedPII,{apiKey:e?.apiKey,clientKey:e?.clientKey,clientName:e?.clientName,checkin:e?.search?.checkin?.toISOString(),checkout:e?.search?.checkout?.toISOString(),children:e?.search?.children,adults:e?.search?.adults,isNoAvailabilityPage:"RoomsAndRates"===e?.pageType&&"noAvailability"===e?.priceCheckData?.ratesModified,targetedMessage:{crmConfigIds:r.crmConfigIds,messageId:r.messageId,messageType:r.messageType,messageIntent:r.messageIntent,variantId:r.variantId,appInstanceId:r.appInstanceId,isTargetingNoAvailability:t.availabilityStatus===z.NoAvailability},pii:{processingConditions:[{lawfulBasis:yi.UserConsent,purposeOfProcessing:bi.Marketing}],email:i.guestEmail,title:i.title,firstName:i.firstName,lastName:i.lastName,fullName:i.fullName,phoneNumber:{countryCode:i.phoneNumber?.countryCode,localNumber:i.phoneNumber?.localNumber},postalCode:i.zipCode}})}function Si(e,t){return e.messagePerType[t]&&e.messagePerType[t].display&&e.messagePerType[t].display.after||0}(yi||(yi={})).UserConsent="UserConsent",(bi||(bi={})).Marketing="Marketing",(vi=wi||(wi={})).UserSubmittedPII="user_submitted_pii",vi.PageDisplayedMessage="page_displayed_message",vi.UserClickedMessageCTA="user_clicked_message-cta",vi.UserClickedMessageClose="user_clicked_message-close",vi.UserClickedMessageBody="user_clicked_message-body",vi.UserHoveredMessage="user_hovered_message";const Ti={[s.crisis]:s.crisis,[s.fullScreen]:s.fullScreen,[s.undercut]:s.undercut,[s.priceCheck]:s.priceCheck,[s.saveTheSearch]:s.saveTheSearch,[s.emailCapture]:s.emailCapture,[s.inline]:s.inline,[s.inPage]:s.inPage,[s.nudge]:s.nudge,[s.countdown]:s.countdown,[s.notifications]:s.notifications,[s.previewAssist]:s.previewAssist};function Pi(e){return{...e,isTargetingNoAvailability:e.availabilityStatus===z.NoAvailability}}function xi(e){return{priceMatchDecisionId:e.priceMatchResponse?.decisionId}}function Di({messageController:e,context:t}){return{apiKey:e.externalState?.apiKey,clientKey:e.externalState?.clientKey,clientName:e.externalState?.clientName,customData:xi(t),targetedMessage:Pi(t)}}const Ai=(e,t,i="onIdle")=>{((e=ui)=>{e.push(document.activeElement)})(),e.showWidget(t,i),e.focusWidget(t)};var Ii=async function(e,t){try{const{data:i}=t;if(i&&i.type){const a=e.isMobile;switch(i.type){case p.platformUpdate:{const i=t.data.payload.messageType;Ti[i]&&e.sendDataToWidget(Ti[i],p.messageEngineWidgetData,{message:t.data.payload.message});break}case p.nudgeReady:e.sendDataToWidget(s.nudge,p.messageEngineWidgetData,{message:e.messagePerType[s.nudge]}),setTimeout((()=>{e.showWidget(s.nudge,"timeout")}),Si(e,s.nudge));break;case p.countdownReady:e.sendDataToWidget(s.countdown,p.messageEngineWidgetData,{message:e.messagePerType[s.countdown]}),setTimeout((()=>{e.showWidget(s.countdown,"timeout")}),Si(e,s.countdown));break;case p.emailCaptureReady:e.sendDataToWidget(s.emailCapture,p.messageEngineWidgetData,{message:e.messagePerType[s.emailCapture]}),setTimeout((()=>{e.showWidget(s.emailCapture,"timeout")}),Si(e,s.emailCapture));break;case p.undercutReady:e.styleWidget(s.undercut,["display","block","important"]),e.sendDataToWidget(s.undercut,p.messageEngineWidgetData,{message:e.messagePerType[s.undercut]});break;case p.priceCheckReady:e.styleWidget(s.priceCheck,["display","block","important"]),e.sendDataToWidget(s.priceCheck,p.messageEngineWidgetData,{message:e.messagePerType[s.priceCheck],isMobile:a,pricingData:e.pricingData,priceMatchResponse:e.priceMatchResponse});break;case p.inlineReady:e.styleWidget(s.inline,["display","block","important"]),e.sendDataToWidget(s.inline,p.messageEngineWidgetData,{message:e.messagePerType[s.inline]});break;case p.previewAssistReady:e.styleWidget(s.previewAssist,["display","block","important"]);const r=Object.entries(e.widgetIframes).filter((([e,t])=>e!==s.previewAssist&&t)),n=!r.length,[o]=r[0]||[];e.sendDataToWidget(s.previewAssist,p.messageEngineWidgetData,{error:n,messageType:o});break;case p.inPageReady:e.styleWidget(s.inPage,["display","block","important"]),e.sendDataToWidget(s.inPage,p.messageEngineWidgetData,{message:e.messagePerType[s.inPage],isMobile:a,pricingData:e.pricingData});break;case p.notificationsReady:e.styleWidget(s.notifications,["display","block","important"]),e.sendDataToWidget(s.notifications,p.messageEngineWidgetData,{notifications:e.notifications});break;case p.saveTheSearchReady:!function(e,t){const i=e.messagePerType[s.saveTheSearch],a=fi(e.externalState,e.logger);if(i){const r={message:i,isMobile:t,shareData:a};e.sendDataToWidget(s.saveTheSearch,p.messageEngineWidgetData,r);const n=Si(e,s.saveTheSearch);if(t)setTimeout((()=>{e.showWidget(s.saveTheSearch,"timeout")}),n);else{const t=0;e.logger.info(`Showing save the search on exit with delay of ${t}ms`),setTimeout((()=>{e.externalState?.isPreview?Ai(e,s.saveTheSearch):li((t=>{Ai(e,s.saveTheSearch,t)}))}),t)}}}(e,a);break;case p.fullScreenReady:{const t=e.messagePerType[s.fullScreen];if(e.sendDataToWidget(s.fullScreen,p.messageEngineWidgetData,{message:t}),t){const i=!e.externalState?.isPreview&&t?.display?.triggerDelay||0;e.logger.info(`Showing fullScreen on exit with delay of ${i}ms`),setTimeout((()=>{e.externalState?.isPreview?Ai(e,s.fullScreen):li((t=>{Ai(e,s.fullScreen,t)}))}),i)}break}case p.crisisReady:{const t=e.messagePerType[s.crisis];if(e.sendDataToWidget(s.crisis,p.messageEngineWidgetData,{message:t}),t){const i=t.display&&t.display.after;e.logger.info(`Showing crisis on entry with delay of ${i}ms`),setTimeout((()=>{Ai(e,s.crisis,"timeout")}),i)}break}case p.forceFullScreenVisible:e.showWidget(s.fullScreen,"trigger");break;case p.trackEventZappy:let c;m.priceCheckReveal===i.eventName&&e.startTime?c=window.performance.now()-e.startTime:m.priceCheckComplete===i.eventName&&e.startTimePricingData&&(c=window.performance.now()-e.startTimePricingData),Oe({eventName:i.eventName,eventAppName:i.eventAppName,payload:{propensityToConvertVersion:i.eventName===m.opened||i.eventName===m.closed?e.likelihoodToConvert&&e.likelihoodToConvert.version:void 0,apiKey:e.internalState&&e.internalState.key,...e.trackingEnrichment,...i.payload,version:e.internalState&&e.internalState.version,timeTaken:c}});break;case p.trackEvent:break;case p.messageDismiss:{const{messageId:t,messageType:a}=i.payload;a!==s.saveTheSearch&&a!==s.fullScreen&&a!==s.crisis||((e=ui)=>{const t=e[e.length-1];t&&t.focus()})(),e.messageLocalStorage&&await e.messageLocalStorage.updateMessageDismisses(t,a),e.removeWidget(a);break}case p.widgetDimensionsChange:{const{messageType:t,width:a,height:r}=i.payload;void 0!==a&&e.styleWidget(t,["width",a,"important"]),void 0!==r&&e.styleWidget(t,["height",r,"important"]);break}case p.localStorageClear:e.localStorage&&e.localStorage.clearAll();break;case p.optOutOfExperiments:e.localStorage&&e.localStorage.set(u.optOutOfExperiments,"true");break;case p.captureGuestEmail:{const t=i.payload,a=i.context;Ci(e.externalState,a,t),e.sendDataToWidget(a.messageType,p.emailRequestFinish,{});break}case p.displayedMessage:{const t=i.context;ki(wi.PageDisplayedMessage,Di({messageController:e,context:t})),[s.inPage,s.priceCheck,s.undercut].includes(t.messageType)||e.messageLocalStorage&&await e.messageLocalStorage.updateMessageReveals(t.messageId,t.messageType);break}case p.clickedMessageCTA:{const t=i.context;ki(wi.UserClickedMessageCTA,Di({messageController:e,context:t}));break}case p.clickedMessageClose:{const t=i.context;ki(wi.UserClickedMessageClose,Di({messageController:e,context:t}));break}case p.clickedMessageBody:{const t=i.context;ki(wi.UserClickedMessageBody,Di({messageController:e,context:t}));break}case p.hoveredMessageBody:{const t=i.context,a=i.payload;ki(wi.UserHoveredMessage,{...Di({messageController:e,context:t}),timeHovered:a.timeHovered});break}case p.clickedCopyToClipboard:{const t=i.payload,a=i.context;Oe({eventName:m.closed,eventAppName:m.abandonment,payload:{...a,messageType:t.messageType,closedBy:t?.isSecondaryAction?"copyToClipboard":"ctaButton",propensityToConvertVersion:e.likelihoodToConvert&&e.likelihoodToConvert.version,apiKey:e.internalState&&e.internalState.key,...e.trackingEnrichment,version:e.internalState&&e.internalState.version}});break}}}}catch(t){e.logger.error(t)}};const _i=()=>{let e;for(;e=document.querySelector("iframe.tt_widget");)e&&e.parentNode&&e.parentNode.removeChild(e)},Mi=async(e,t,i,a)=>(({logger:e,...t})=>{e.info("Deciding which messages to handle",t);const{saveTheSearch:i,nudge:a,fullScreen:r,priceCheck:n,inPage:o,undercut:c,emailCapture:l,crisis:d,countdown:p,inline:g}=s,{webShareAPIAvailable:u,localStorageAvailable:h,isMobile:m,pageType:f}=t,y=f===K.RoomsAndRates,b=y&&t.hasRateDetails,w=f===K.Confirmation,v=[...b&&!m?[c]:[],...b?[n,o]:[]];if(!h)return v;const k=!m||u,C=[...v,...w||m?[]:[l,a,p,r,o,d],...!w&&m?[o,a,p]:[],...w?[a]:[],...y&&k?[i]:[],g];return e.diagnostics.addHandledMessageTypes(C,t),C})({localStorageAvailable:await i.isAvailable(),webShareAPIAvailable:await i.webShareAPIAvailable(),pageType:e.pageType,isMobile:t,logger:a,hasRateDetails:Boolean(e.priceCheckData?.rateDetails?.length)});var Ri=({notificationType:e,apiKey:t,messageDismisses:i})=>{const a=He(t,e,s.notifications);return Boolean(i&&Date.now()-i[a]e.pageType===K.RoomsAndRates&&!Ri({notificationType:a,apiKey:t,messageDismisses:i});var Ei=({externalState:e,internalState:{key:t,messageDismisses:i,latestVisitInfo:a},getCurrentTime:r=Date.now})=>{const s=Et(),n=e.pageType!==K.RoomsAndRates;s.info("notRoomsAndRatesPage",{notRoomsAndRatesPage:n,pageType:e.pageType});const o=!Ri({notificationType:l.location,apiKey:t,messageDismisses:i});s.info("notDismissedRecently",{notDismissedRecently:o,apiKey:t,messageDismisses:i});const c=(({latestVisitInfo:e,numberOfPages:t})=>e.pageViews>=t)({latestVisitInfo:a,numberOfPages:2});s.info("seenNumberOfPages",{seenNumberOfPages:c,latestVisitInfo:a});const d=(({latestVisitInfo:e,time:t,getCurrentTime:i})=>i()-t>=e.firstSeen)({latestVisitInfo:a,time:3e4,getCurrentTime:r});return s.info("beenOnSiteForTime",{beenOnSiteForTime:d,latestVisitInfo:a,getCurrentTime:r()}),n&&o&&c&&d};const Oi=(e,t,i)=>{const a={};if(!i.isMobile)return e.bookers&&Ni({externalState:t,internalState:i,notificationType:l.bookers})&&(a[l.bookers]=e.bookers),e.searchers&&Ni({externalState:t,internalState:i,notificationType:l.searchers})&&(a[l.searchers]=e.searchers),e.location&&Ei({externalState:t,internalState:i})&&(a.location=e.location),Object.keys(a).length>0?a:void 0};var Ui=function(e,t){e&&e.contentWindow&&e.contentWindow.postMessage(t,"*")};function Wi({iframe:e,trigger:t}){Ui(e,{type:p.messageEngineShowWidget,payload:{show:!0,trigger:t}})}var qi=function(e,t){e&&e.contentWindow&&(e.style.setProperty("display","block","important"),window.requestAnimationFrame?window.requestAnimationFrame((()=>Wi({iframe:e,trigger:t}))):Wi({iframe:e,trigger:t}))};let Ki;!function(e){e.bestDirect="bestDirect",e.allUndercut="allUndercut",e.unknown="unknown"}(Ki||(Ki={}));const Li={},$i={left:"0",top:"0"},Bi={left:"0",bottom:"0"},zi={left:"0",right:"0",bottom:"0"},Vi={[s.saveTheSearch]:{mobile:zi,desktop:$i},[s.countdown]:{mobile:Bi,desktop:Bi},[s.crisis]:{mobile:Li,desktop:$i},[s.emailCapture]:{mobile:Li,desktop:Bi},[s.fullScreen]:{mobile:Li,desktop:$i},[s.inPage]:{mobile:Li,desktop:$i},[s.inline]:{mobile:Li,desktop:$i},[s.notifications]:{mobile:Li,desktop:{right:"0",top:"80px"}},[s.nudge]:{mobile:Bi,desktop:Bi},[s.priceCheck]:{mobile:zi,desktop:{right:"6px",bottom:"6px"}},[s.undercut]:{mobile:Li,desktop:{right:"0",bottom:"0"}},[s.previewAssist]:{mobile:Li,desktop:{top:"0px"}}};function ji(e,t){return Vi[e.type][t?"mobile":"desktop"]||{}}function Fi(e){return!!e&&["top","right","bottom","left"].some((t=>e.hasOwnProperty(t)))}function Hi(e,t){return{top:e.top||"auto",right:e.right||(t?"0px":"auto"),bottom:e.bottom||"auto",left:e.left||(t?"0px":"auto")}}var Gi={use:()=>{if(!document.getElementById("tt_styles")){const t=document.createElement("style");t.id="tt_styles",t.appendChild(document.createTextNode(e(".tt_widget{-webkit-user-select:none;user-select:none;pointer-events:auto;background:0 0;border:0;display:none;position:fixed}.tt_widget.tt_widget--platform{position:absolute}#tt_nudge,#tt_countdown{height:212px;z-index:2147483645;width:100%!important;max-width:100%!important}@media (min-width:432px){#tt_nudge,#tt_countdown{max-width:432px!important}}#tt_email-capture{width:440px;height:200px;z-index:2147483644}#tt_undercut{width:280px;height:260px;z-index:2147483643}#tt_price-check{width:254px;height:260px;z-index:2147483642;visibility:visible!important;opacity:1!important}#tt_price-check_price-match{width:290px;height:260px;z-index:2147483642;visibility:visible!important;opacity:1!important}#tt_price-check.tt_widget--mobile{width:100%;height:0;z-index:2147483642}#tt_preview-assist.tt_widget--preview{-webkit-user-select:auto;user-select:auto;width:100%;background:0 0;display:block}#tt_notifications{width:0;height:0;z-index:2147483641;top:80px;right:0}#tt_full-screen{width:100%;height:100%;z-index:2147483647}#tt_in-page,#tt_inline{width:100%;height:0;position:relative}#tt_crisis,#tt_save-the-search{width:100%;height:100%;z-index:2147483647}#tt_save-the-search.tt_widget--mobile{height:68px}"))),document.head.appendChild(t)}}};class Xi{constructor(e,t,i){this.logger=e,this.internalState=t,this.externalState=i}trackPlacementSelector(e,t){Oe({eventName:m.placementSelector,eventAppName:m.messageEngine,payload:{found:e,messageId:t.id,messageType:t.type,variantId:t.variantId,pageUrl:this.externalState.pageUrl,apiKey:this.internalState.key,pageVisitId:this.externalState.pageVisitId,userId:this.externalState.userId,sessionId:this.externalState.sessionId,clientName:this.externalState.clientName}})}prepareIframe(e,t,i){e.setAttribute("title","Overlay Message"),e.setAttribute("id",`tt_${t}`),i&&e.setAttribute("id","tt_price-check_price-match");const a=this.internalState.isMobile?" tt_widget--mobile":"",r=this.externalState.isPreview?" tt_widget--preview":"";e.setAttribute("class",`tt_widget${a}${r}`),Gi.use()}createWidgetIframe(e,t,i={},a){const r=document.createElement("iframe");r.src=Ji[e],this.prepareIframe(r,e,a);const s=this.getIframeStylesForMessage(t);return Object.entries(s).forEach((([e,t])=>{void 0!==t&&r.style.setProperty(e,t,"important")})),Object.entries(i).forEach((([e,t])=>{void 0!==t&&r.style.setProperty(e,t,"important")})),r}getMessagePosition(e){const t=this.internalState.isMobile,i=t?e.messagePositionMobile:e.messagePosition;return Fi(i)?Hi(i,t):ji(e,t)}getMessageZIndex(e){return this.internalState.isMobile&&e.messagePositionMobile?e.messagePositionMobile["z-index"]:e.messagePosition?e.messagePosition["z-index"]:void 0}getIframeStylesForMessage(e){if(!e)return{};const t=this.getMessageZIndex(e);return{...this.getMessagePosition(e),...t&&{"z-index":t}}}addPreviewInfoWidget(e){Object.entries({right:"0",top:"0",left:"0","z-index":"100000"}).forEach((([t,i])=>{void 0!==i&&e.style.setProperty(t,i,"important")})),document.body.appendChild(e)}loadPopUpWidget(e,t,i){const a=this.createWidgetIframe(e,t||null,{},i);return document.body.appendChild(a),this.logger.info(`Added ${e} to document body`),a}loadEmbeddedWidget(e,t){const i=function(e){try{return document.evaluate(e,document,null,XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue}catch(e){return null}}(t.placementSelector);if(this.externalState.isPreview||this.trackPlacementSelector(!!i,t),i){let t=function(e){return{padding:window.getComputedStyle(e)?.padding,"padding-bottom":"0px","padding-top":"0px"}}(i);const a=this.createWidgetIframe(e,null,t);return i.parentNode&&i.parentNode.insertBefore(a,i.nextSibling),this.logger.info(`Added ${e} to document body`),a}this.logger.warn(`No target element found for InPage widget with placementSelector ${t.placementSelector}`)}loadPreviewAssist(){const e=document.createElement("iframe");return e.src=Ae.previewAssistSrc,this.prepareIframe(e,s.previewAssist),this.addPreviewInfoWidget(e),this.logger.info("Added preview assist to document body"),e}}const Ji={[s.saveTheSearch]:Ae.saveTheSearchSrc,[s.nudge]:Ae.nudgeSrc,[s.countdown]:Ae.countdownSrc,[s.undercut]:Ae.undercutSrc,[s.priceCheck]:Ae.priceCheckSrc,[s.notifications]:Ae.notificationsSrc,[s.fullScreen]:Ae.fullScreenSrc,[s.crisis]:Ae.crisisSrc,[s.inline]:Ae.inlineSrc,[s.inPage]:Ae.inPageSrc,[s.emailCapture]:Ae.emailCaptureSrc,[s.previewAssist]:Ae.previewAssistSrc};class Zi{constructor(e,t,i,a,r,s){this.logger=e,this.internalState=t,this.externalState=i,this.messagePerType=a,this.notifications=r,this.loader=s||new Xi(this.logger,this.internalState,this.externalState)}loadSaveTheSearch(){const e=this.messagePerType[s.saveTheSearch];if(e)return this.loader.loadPopUpWidget(s.saveTheSearch,e)}loadEmailCapture(){const e=this.messagePerType[s.emailCapture];if(e)return this.loader.loadPopUpWidget(s.emailCapture,e)}loadNudge(){const e=this.messagePerType[s.nudge];if(e)return this.loader.loadPopUpWidget(s.nudge,e)}loadCountdown(){const e=this.messagePerType[s.countdown];if(e)return this.loader.loadPopUpWidget(s.countdown,e)}loadFullScreen(){const e=this.messagePerType[s.fullScreen];if(e)return this.loader.loadPopUpWidget(s.fullScreen,e)}loadCrisis(){const e=this.messagePerType[s.crisis];if(e)return this.loader.loadPopUpWidget(s.crisis,e)}loadNotifications(){if(this.notifications)return this.loader.loadPopUpWidget(s.notifications)}loadInline(){const e=this.messagePerType[s.inline];if(e)return this.loader.loadEmbeddedWidget(s.inline,e)}loadInPage(e){const t=this.messagePerType[s.inPage];if(t&&(t.content.type!==k.PriceCheck||e))return this.loader.loadEmbeddedWidget(s.inPage,t)}loadPriceCheck(e){const t=this.messagePerType[s.priceCheck];if(t&&e&&e.pricingScenario===Ki.bestDirect)return this.loader.loadPopUpWidget(s.priceCheck,t)}loadPriceCheckWithPriceMatch(){const e=this.messagePerType[s.priceCheck];if(e)return this.logger.info("Loading Price Check with Price Match"),this.loader.loadPopUpWidget(s.priceCheck,e,!0)}loadUndercut(e,t){const i=this.messagePerType[s.undercut];if(i&&(t&&t.pricingScenario===Ki.allUndercut||e))return this.loader.loadPopUpWidget(s.undercut,i)}loadPreviewAssist(){return this.loader.loadPreviewAssist()}}const Yi=[s.priceCheck,s.countdown,s.emailCapture,s.nudge,s.notifications,s.undercut],Qi=[s.crisis,s.fullScreen,s.saveTheSearch],ea={[s.saveTheSearch]:{desktop:"",mobile:"bottom"},[s.notifications]:{desktop:"top_right",mobile:""},[s.priceCheck]:{desktop:"bottom_right",mobile:"bottom"},[s.nudge]:{desktop:"bottom_left",mobile:"bottom"},[s.countdown]:{desktop:"bottom_left",mobile:"bottom"},[s.emailCapture]:{desktop:"bottom_left",mobile:""},[s.undercut]:{desktop:"bottom_right",mobile:""},[s.fullScreen]:{desktop:"center",mobile:""},[s.crisis]:{desktop:"center",mobile:""},[s.inline]:{desktop:"",mobile:""},[s.inPage]:{desktop:"",mobile:""},[s.saveTheSearch]:{desktop:"center",mobile:"bottom"},[s.previewAssist]:{desktop:"center",mobile:"bottom"}};function ta(e){return e&&e.top?"top":"bottom"}function ia(e,t,i){const a={},r={},n={};let o=t;Object.values(e).forEach((e=>{if(!e)return;const t=function(e,t){const i=t?e.messagePositionMobile:e.messagePosition;if(Fi(i))return t?`${ta(i)}`:`${ta(i)}_${function(e){return e&&e.left?"left":"right"}(i)}`;const a=ea[e.type];return t?a.mobile:a.desktop}(e,i);var s,o;t?(a[e.type]=t,r[t]?r[t]=Qi.includes(e.type)?(s=r[t],o=e,Qi.indexOf(s.type)({...e,[t.type]:t})),n);return a[s.priceCheck]&&a[s.undercut]&&a[s.priceCheck]===a[s.undercut]&&(c[s.priceCheck]&&(c[s.undercut]=e[s.undercut]),c[s.undercut]&&(c[s.priceCheck]=e[s.priceCheck])),{messages:c,notifications:o}}function aa(e,t,i,a,r){try{const r=ra(e,t);return sa(i,a)&&r.push({id:"NOTIFICATIONS",name:"NOTIFICATIONS",type:s.notifications}),r}catch(e){return r.error(e),[]}}const ra=(e,t)=>{const i=[];return Object.entries(e).forEach((([e,a])=>{a&&(e in t||i.push({id:a.id,name:a.name,type:a.type}))})),i},sa=(e,t)=>Boolean(e&&!t),na=(e,t)=>{try{return t.filter((t=>!e.includes(t.type)))}catch(e){return[]}};var oa=async({messageId:e,client:t,apiKey:i,language:a,config:r=Ae,logger:s})=>{try{const n=new URL(`${r.campaignServiceUrl}/client/${t}/${i}/campaign/${e}`);a&&n.searchParams.set("language",a);const o=await Ie({url:n.href});return 200===o.status?JSON.parse(o.body):void s.error(`Call to get preview message ${e} failed. No message found`)}catch(e){s.error(e)}},ca=(e,t)=>({ticketId:"test",complete:!0,pricingScenario:t===s.undercut?Y.allUndercut:Y.bestDirect,directRate:{price:205.33,currency:"USD",rateName:"Best Direct"},otaPrices:[{name:"OTA 1",price:{value:206.29,currency:"USD"}},{name:"OTA 2",price:{value:207,currency:"USD"}},{name:"OTA 3",price:null}],searchCriteria:{adults:e.search?.adults||2,children:e.search?.children||1,checkin:e.search?.checkin||new Date,checkout:e.search?.checkout||new Date,language:e?.language}});let la;var da;(da=la||(la={})).booking="Booking.com",da.trivago="trivago",da.expedia="Expedia.com",da.hotels="Hotels.com",da.orbitz="Orbitz.com",da.hrs="HRS.de",da.agoda="Agoda.com",da.lastminute="Lastminute.com",da.priceline="priceline.com",da.travelocity="Travelocity",da.venere="Venere.com",da.ebookers="ebookers",da.travelrepublic="Travelrepublic",da.trip="Trip.com",da.makemytrip="MakeMyTrip",da.traveloka="Traveloka",da.amoma="Amoma",da.decolar="Decolar",da.despegar="Despegar",da.traveluro="Traveluro",da.snaptravel="Snaptravel";const pa=[la.booking,la.trivago,la.expedia,la.hotels,la.orbitz,la.hrs,la.agoda,la.lastminute,la.priceline,la.travelocity,la.venere,la.ebookers,la.travelrepublic,la.trip,la.makemytrip,la.traveloka,la.amoma,la.decolar,la.despegar,la.traveluro,la.snaptravel],ga=(la.agoda,la.hotels,la.expedia,la.booking,la.agoda,la.hotels,la.expedia,la.booking,la.booking,la.ebookers,la.expedia,la.hotels,la.lastminute,la.makemytrip,la.priceline,la.snaptravel,la.travelocity,la.travelrepublic,la.booking,la.ebookers,la.expedia,la.hotels,la.lastminute,la.makemytrip,la.priceline,la.snaptravel,la.travelocity,la.travelrepublic,la.agoda,la.booking,la.expedia,la.hotels,la.trip,la.agoda,la.booking,la.expedia,la.hotels,la.hrs,la.lastminute,la.makemytrip,la.priceline,la.traveloka,la.trip,la.agoda,la.booking,la.expedia,la.hotels,la.lastminute,la.makemytrip,la.priceline,la.traveloka,la.trip,la.hrs,la.hotels,la.expedia,la.hrs,la.hotels,la.expedia,la.hrs,la.hotels,la.expedia,la.hrs,la.hotels,la.expedia,la.hrs,la.hotels,la.expedia,la.hrs,la.hotels,la.expedia,la.hrs,la.hotels,la.expedia,la.hrs,la.hotels,la.expedia,la.agoda,la.booking,la.expedia,la.hotels,la.orbitz,la.travelocity,la.traveloka,la.trip,la.agoda,la.booking,la.decolar,la.despegar,la.expedia,la.hotels,la.lastminute,la.makemytrip,la.orbitz,la.priceline,la.travelocity,la.traveloka,la.travelrepublic,la.trip,la.agoda,la.booking,la.expedia,la.hotels,la.lastminute,la.makemytrip,la.orbitz,la.priceline,la.snaptravel,la.travelocity,la.traveloka,la.travelrepublic,la.trip,la.agoda,la.booking,la.expedia,la.hotels,la.lastminute,la.makemytrip,la.orbitz,la.priceline,la.traveloka,la.trip,la.booking,la.expedia,la.hotels,la.lastminute,la.priceline,la.travelrepublic,la.agoda,la.booking,la.expedia,la.hotels,la.lastminute,la.priceline,la.travelrepublic,la.agoda,la.booking,la.expedia,la.hotels,la.lastminute,la.orbitz,la.priceline,la.travelrepublic,la.agoda,la.booking,la.expedia,la.hotels,la.lastminute,la.priceline,la.travelrepublic,la.agoda,la.booking,la.expedia,la.hotels,la.lastminute,la.priceline,la.travelrepublic,la.agoda,la.booking,la.decolar,la.despegar,la.expedia,la.hotels,la.lastminute,la.orbitz,la.priceline,la.snaptravel,la.travelocity,la.travelrepublic,la.traveluro,la.trip,la.agoda,la.booking,la.decolar,la.despegar,la.expedia,la.hotels,la.lastminute,la.snaptravel,la.travelocity,la.traveluro,la.booking,la.expedia,la.hotels,la.orbitz,la.travelocity,la.agoda,la.booking,la.despegar,la.expedia,la.hotels,la.agoda,la.booking,la.despegar,la.expedia,la.hotels,la.booking,la.expedia,la.hotels,la.orbitz,la.travelocity,la.agoda,la.booking,la.expedia,la.hotels,la.agoda,la.booking,la.expedia,la.hotels,la.lastminute,la.orbitz,la.snaptravel,la.travelrepublic,la.trip,la.agoda,la.booking,la.expedia,la.hotels,la.agoda,la.booking,la.expedia,la.hotels,la.priceline,la.trip,la.agoda,la.booking,la.expedia,la.hotels,la.agoda,la.booking,la.ebookers,la.expedia,la.hotels,la.hrs,la.orbitz,la.travelocity,la.trip,la.booking,la.expedia,la.hotels,la.orbitz,la.agoda,la.booking,la.expedia,la.hotels,la.trip,la.agoda,la.booking,la.decolar,la.despegar,la.expedia,la.hotels,la.lastminute,la.orbitz,la.priceline,la.snaptravel,la.travelocity,la.travelrepublic,la.traveluro,la.trip,la.agoda,la.booking,la.decolar,la.despegar,la.expedia,la.hotels,la.lastminute,la.orbitz,la.priceline,la.snaptravel,la.travelocity,la.travelrepublic,la.traveluro,la.trip,la.agoda,la.booking,la.expedia,la.hotels,la.agoda,la.booking,la.expedia,la.hotels,la.agoda,la.booking,la.expedia,la.hotels,la.agoda,la.booking,la.expedia,la.hotels,la.agoda,la.booking,la.expedia,la.hotels,la.agoda,la.booking,la.expedia,la.hotels,la.agoda,la.booking,la.expedia,la.hotels,la.agoda,la.booking,la.expedia,la.hotels,la.agoda,la.booking,la.expedia,la.hotels,e=>{const t=wt(e).includes("tt_pmd");return yt(e)&&t}),ua=e=>wt(e).includes("showonsitepricematch=true"),ha=e=>null!==e.price,ma=(e,t)=>e.prices.filter(ha).filter((e=>t.includes(e.name)));const fa=(e,t=1e4)=>new Promise(((i,a)=>{setTimeout((()=>a(new Error("RequestTimeout"))),t),e.then(i,a)}));class ya{constructor(e){this.logger=e}buildApiRequestBody(e,t){if(e.priceCheckData)return{applications:e.applications,adults:`${e.priceCheckData.adults}`,children:`${e.priceCheckData.children||0}`,checkin:Ze(e.priceCheckData.checkin),checkout:Ze(e.priceCheckData.checkout),rooms:`${e.priceCheckData.rooms||1}`,token:t.key,total:`${!!e.priceCheckData.total}`,priceComponents:e.priceCheckData.priceComponents,rateDetails:e.priceCheckData.rateDetails,promoCodes:e.priceCheckData.promoCodes,allowedRates:e.priceCheckData.allowedRates,excludedRates:e.priceCheckData.excludedRates,allowedPromoCodes:e.priceCheckData.allowedPromoCodes,ratesModified:e.priceCheckData.ratesModified,onboardEventId:e.onboardEventId,_cid:e.userId,_sid:e.sessionId,_pid:e.pageVisitId,_ref:e.pageUrl}}async handleApiResponse(e){if(200===e.status||this.logger.diagnostics.isActive()){const t=await e.json().catch((()=>null));if(this.logger.diagnostics.sendPricingApiResult(t),!t||Array.isArray(t))return;return t}}async initialOTAPriceRequest(e,t){const i=await fetch(`${Ae.priceCheckApiUrl}/price-check`,{method:"POST",body:JSON.stringify(e),headers:{"Content-Type":"application/json"},signal:t}),a=await this.handleApiResponse(i);if(a)return this.latestStatusUrl=a._links.status,a}async subsequentOTAPriceRequest(e,t){const i=await fetch(e,{signal:t});return this.handleApiResponse(i)}}function ba(e,t,i,a){return new Promise(((r,s)=>{const n=setTimeout(r,e);if(t){const e=()=>{i.info(`${a}: Abort signal received during delay, clearing timeout`),clearTimeout(n),s(new DOMException("Aborted","AbortError"))};if(t.aborted)return i.info(`${a}: Signal already aborted at start of delay, stopping immediately`),clearTimeout(n),void s(new DOMException("Aborted","AbortError"));t.addEventListener("abort",e,{once:!0});const o=r;r=r=>{t.removeEventListener("abort",e),i.info(`${a}: Callback delay completed normally`),o(r)}}}))}const wa=e=>!(e.prices.length<1)&&(!!e.complete&&e.prices.every((({price:t})=>!!(t&&t.valuee.filter((e=>null===e.price||e.price.value>=t.price)).sort(((e,t)=>e.price&&t.price?e.price.value-t.price.value:e.price?-1:t.price?1:0)),ka=(e=[],t)=>{const i=(e=>e.filter((({tags:e})=>!e||!e.includes("member"))).sort(((e,t)=>e.price-t.price))[0])(e);if(i&&!(t.price>=i.price))return i},Ca=({priceCheckData:e,language:t,pricingApiResult:i})=>{return(a=i).prices.length<1||!a.prices.some((({price:e})=>!e||e.value>=a.directRate.price))?wa(i)?{ticketId:i.ticketId,pricingScenario:Ki.allUndercut,directRate:i.directRate,otaPrices:va(i.prices,i.directRate),complete:i.complete,searchCriteria:{language:t,adults:e.adults,children:e.children,checkin:e.checkin,checkout:e.checkout}}:{ticketId:i.ticketId,pricingScenario:Ki.unknown,directRate:i.directRate,otaPrices:[],complete:i.complete,searchCriteria:{language:t,adults:e.adults,children:e.children,checkin:e.checkin,checkout:e.checkout}}:{ticketId:i.ticketId,pricingScenario:Ki.bestDirect,directRate:i.directRate,otaPrices:va(i.prices,i.directRate),nonMemberRate:ka(e?.rateDetails,i.directRate),complete:i.complete,searchCriteria:{adults:e.adults,children:e.children,checkin:e.checkin,checkout:e.checkout,language:t}};var a};class Sa{constructor(e,t=fetch.bind(window)){this.logger=e,this.fetchFn=t,this.campaignServiceUrl=Ae.campaignServiceUrl}async getPriceMatchUrl(e,t,i,a){try{const r=this.toPriceMatchRequest(e,t,i,a),s=await this.fetchFn(`${this.campaignServiceUrl}/priceMatch`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(r)});return this.handleResult(s)}catch(e){return void this.logger.warn("Unable to get any data from Price Match API",e)}}async getPriceMatchConfig({apiKey:e}){try{const t=await this.fetchFn(`${this.campaignServiceUrl}/priceMatch/config/${e}`);return 200!==t.status?void this.logger.warn("Unable to fetch price match config"):(await t.json()).config??void 0}catch(e){return void this.logger.warn("Unable to fetch price match config",e)}}toPriceMatchRequest(e,t,i,a){return{apiKey:e.apiKey,search:{checkin:Ze(e.search.checkin),checkout:Ze(e.search.checkout),adults:e.search.adults,children:e.search.children},directRate:{...t,priceComponents:a},otaPrices:i.map((e=>({name:e.name,price:{amount:e.price.value,currency:e.price.currency}})))}}async handleResult(e){if(e&&200===e.status){return await e.json()}}}const Ta=Et(),Pa=new class extends ya{getPricingData(e,t,i,a){this.pollApiUntilComplete(e,t,i,a)}async pollApiUntilComplete(e,t,i,a){const r=this.buildApiRequestBody(t,e);r&&(a?.aborted?this.logger.info("PollingPriceCheckApi: Request already aborted, not starting poll"):await this.doRequest(t,this.initialOTAPriceRequest(r,a),i,a))}async doRequest(e,t,i,a){try{const r=await t;if(a?.aborted)return void this.logger.info("PollingPriceCheckApi: Request aborted after API call completion, stopping polling");if(!r||this.latestStatusUrl!==r._links.status)return;this.logger.info("PollingPriceCheckApi: Processing pricing data",{complete:r.complete,callbackDelay:r.callbackDelay,aborted:a?.aborted});if(i(Ca({priceCheckData:e.priceCheckData,language:e.language,pricingApiResult:r})),r.complete)return;if(a?.aborted)return void this.logger.info("PollingPriceCheckApi: Request aborted before continuing polling, stopping");if(this.logger.info("PollingPriceCheckApi: Starting callback delay",{delay:r.callbackDelay,aborted:a?.aborted}),await ba(r.callbackDelay,a,this.logger,"PollingPriceCheckApi"),a?.aborted)return void this.logger.info("PollingPriceCheckApi: Request aborted after delay completion, stopping polling");this.logger.info("PollingPriceCheckApi: Continuing to next polling request"),await this.doRequest(e,this.subsequentOTAPriceRequest(`${Ae.priceCheckApiUrl}${r._links.status}`,a),i,a)}catch(e){if(e instanceof Error&&"AbortError"===e.name)return void this.logger.info("PollingPriceCheckApi: Request aborted with AbortError, stopping polling chain");throw this.logger.error("PollingPriceCheckApi: Unexpected error during polling",e),e}}}(Ta),xa=new class{constructor(e){this.logger=e}async getMetaParityData(e,t){const i=Ae.campaignServiceUrl;try{this.logger.info("Getting Meta Parity data");const a=await fa(fetch(`${i}/${e.apiKey}/${t}/meta-parity-data`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({apiKey:e.apiKey,checkin:e.search?.checkin,checkout:e.search?.checkout,adults:e.search?.adults})}));return this.handleMetaParityResult(a)}catch(e){return void this.logger.warn("Unable to get any data from Meta Parity API")}}async handleMetaParityResult(e){if(e&&200===e.status){const t=await e.json();if(!t||Array.isArray(t)||!t.data)return;return t}}}(Ta),Da=new class{constructor(e,t,i){this.logger=e,this.priceMatchApi=t,this.priceCheckApi=i}async getPriceMatchData(e,t,i){if(!t.priceCheckData)return void this.logger.error("Price check data is missing");const a=await this.priceCheckApi.getPricingData(e,t);if(!a)return void this.logger.error("Unable to get any data from Price Check API");if(a.directRate.tags?.includes("member"))return void this.logger.info("Ignoring price match because direct rate is a member rate");const{priceCheckData:r,language:s}=t,n=ma(a,i);if(0===n.length||(o=a.directRate,n.every((({price:e})=>e&&o.price<=e.value))))return this.logger.info("Ignoring price match because direct is cheaper than all OTAs"),{pricingData:{...Ca({priceCheckData:r,language:s,pricingApiResult:a})}};var o;const c=await this.priceMatchApi.getPriceMatchUrl(t,a.directRate,n,r?.priceComponents);return this.handleResponse(a,c,r,s)}handleResponse(e,t,i,a){return t&&t.discountedPrice.percentage?{priceMatchResponse:t,pricingData:{ticketId:e.ticketId,pricingScenario:Ki.unknown,directRate:e.directRate,otaPrices:this.filterOTAsForOnSitePriceMatch(e.prices,t.discountedPrice),complete:e.complete,searchCriteria:{adults:i.adults,children:i.children,checkin:i.checkin,checkout:i.checkout,language:a}}}:(this.logger.info("Returning price check data because the price match API returned no data"),{pricingData:{...Ca({priceCheckData:i,language:a,pricingApiResult:e})}})}filterOTAsForOnSitePriceMatch(e,t){return e.filter((e=>e.price&&e.price.value>=t.amount)).sort(((e,t)=>e.price&&t.price?e.price.value-t.price.value:e.price?-1:t.price?1:0))}}(Ta,new Sa(Ta),new class extends ya{async getPricingData(e,t,i){if(!t.priceCheckData)return void this.logger.error("Price check data is missing");const a=this.buildApiRequestBody(t,e);if(!a)return void this.logger.error("Price check data is missing");if(i?.aborted)return void this.logger.info("CompleteResponsePriceCheckApi: Request already aborted, not starting poll");return await this.pollUntilPriceCheckApiReturnsComplete(t,this.initialOTAPriceRequest(a,i),i)}async pollUntilPriceCheckApiReturnsComplete(e,t,i){try{this.logger.info("CompleteResponsePriceCheckApi: Starting API request",{aborted:i?.aborted});const a=await t;if(i?.aborted)return void this.logger.info("CompleteResponsePriceCheckApi: Request aborted after API call completion, stopping polling");if(!a||this.latestStatusUrl!==a._links.status)return;return a.complete?a:i?.aborted?void this.logger.info("CompleteResponsePriceCheckApi: Request aborted before continuing polling, stopping"):(await ba(a.callbackDelay,i,this.logger,"CompleteResponsePriceCheckApi"),i?.aborted?void this.logger.info("CompleteResponsePriceCheckApi: Request aborted after delay completion, stopping polling"):(this.logger.info("CompleteResponsePriceCheckApi: Continuing to next polling request"),await this.pollUntilPriceCheckApiReturnsComplete(e,this.subsequentOTAPriceRequest(`${Ae.priceCheckApiUrl}${a._links.status}`,i),i)))}catch(e){if(e instanceof Error&&"AbortError"===e.name)return void this.logger.info("CompleteResponsePriceCheckApi: Request aborted with AbortError, stopping polling chain");throw this.logger.error("CompleteResponsePriceCheckApi: Unexpected error during polling",e),e}}}(Ta)),Aa=new Sa(Ta),Ia=new class{constructor(e){this.priceMatchApi=e}async get({apiKey:e}){return this.priceMatchApi.getPriceMatchConfig({apiKey:e})}}(Aa),_a=new class{constructor(e,t,i,a,r,s){this.logger=e,this.pricingApi=t,this.metaParityApi=i,this.priceCheckWithPriceMatchApi=a,this.priceMatchConfig=r,this.localStorage=s,this.onWindowMessage=Ii.bind(void 0,this),this.removeWidget=e=>{try{const t=this.widgetIframes[e];t&&(t.style.setProperty("display","none"),t.remove())}catch(e){this.logger.error(e)}},this.styleWidget=(e,t)=>{try{const i=this.widgetIframes[e];i&&i.style&&i.style.setProperty(...t)}catch(e){this.logger.error(e)}},this.sendDataToWidget=(e,t,i)=>{try{const a=this.widgetIframes[e];a&&Ui(a,{type:t,payload:i})}catch(e){this.logger.error(e)}},this.sendDataToAllWidgets=(e,t)=>{try{Object.values(this.widgetIframes).forEach((i=>{i&&Ui(i,{type:e,payload:t})}))}catch(e){this.logger.error(e)}},this.showWidget=(e,t)=>{try{const i=this.widgetIframes[e];i&&qi(i,t)}catch(e){this.logger.error(e)}},this.focusWidget=e=>{try{const t=this.widgetIframes[e];t&&t.focus()}catch(e){this.logger.error(e)}},this.clearAllWidgets=()=>{_i(),this.widgetIframes={}},this.widgetIframes={},this.messagePerType={},this.isMobile=!1,this.startTime=window.performance.now()}addNonPriceDataWidgetIframes(e){this.widgetIframes[s.crisis]=e.loadCrisis(),this.widgetIframes[s.fullScreen]=e.loadFullScreen(),this.widgetIframes[s.notifications]=e.loadNotifications(),this.widgetIframes[s.emailCapture]=e.loadEmailCapture(),this.widgetIframes[s.nudge]=e.loadNudge(),this.widgetIframes[s.countdown]=e.loadCountdown(),this.widgetIframes[s.saveTheSearch]=e.loadSaveTheSearch(),this.widgetIframes[s.inline]=e.loadInline()}getPreviewMessageId(e=this.externalState){const[t,...i]=e.pageUrl.split("?"),a=i.join("");return(new RegExp("preview=(\\w*)(&?)").exec(a)||[])[1]}isMetaLandingPageAndMemberRate(){const e=/(tt_meta|wh_token)/,t=e.test(this.externalState?.pageUrl??"")||e.test(this.externalState?.referrer??""),i=this.externalState?.priceCheckData&&(a=this.externalState?.priceCheckData,a.rateDetails.some((e=>e.tags?.includes("member"))));var a;return t&&i}async loadsChoosesDisplaysMessages(e,t){try{if(this.externalState=e,this.logger.info("External state:",this.externalState),this.logger.info("Removing window event listener"),window.removeEventListener("message",this.onWindowMessage),this.logger.info("Adding window event listener"),window.addEventListener("message",this.onWindowMessage),this.isMobile=$e(e),e.isPreview)return this.handlePreviewMessage();this.localStorage=await this.createLocalStorage(),this.messageLocalStorage=new Xe(this.localStorage,t.key);const i={userId:e.userId,sessionId:e.sessionId,pageVisitId:e.pageVisitId,clientName:e.clientName,version:t.version};this.trackingEnrichment=i;const{messages:a,countryCode:r,regionCode:n,city:o,notifications:c}=await Je({apiKey:t.key,logger:this.logger,language:e.language});this.logger.diagnostics.addMessages(a),this.clearAllWidgets();const[l,d,p,g]=await Promise.all([pt({localStorage:this.localStorage,apiKey:t.key,currentTimestamp:Date.now(),search:e.search}),gt(this.localStorage,t.key,e.search),this.messageLocalStorage.getMessageReveals(),this.messageLocalStorage.getMessageDismisses()]),u=ge(t,l,p,g,d,this.isMobile,r,n,o);this.internalState=u,this.logger.info("Internal state:",this.internalState);const h=new ft(u,e);this.likelihoodToConvert=h,this.logger.info("PTC:",this.likelihoodToConvert);const m=await Mi(e,this.isMobile,this.localStorage,this.logger);this.logger.info("Handled message types:",m);const f=na(m,a);this.logger.diagnostics.messageTypeNotHandled(f);const y=m.reduce(((t,r)=>({...t,[r]:ei({messageType:r,messages:a,internalState:u,externalState:e,likelihoodToConvert:h,userId:i.userId,logger:this.logger})})),{});this.logger.info("Message per type:",y);const b=Oi(c,e,u),w=ia(y,b,this.isMobile);this.messagePerType=w.messages,this.notifications=w.notifications,this.logger.info("Non-overlapping message per type:",this.messagePerType);const v=aa(y,w.messages,b,w.notifications,this.logger);if(this.logger.diagnostics.excludedDueToOverlap(v),this.logger.info("Notifications per type:",this.notifications),this.isMetaLandingPageAndMemberRate()){this.logger.info("Price Check is disabled due to Meta landing page optimisation");const e=this.messagePerType[s.priceCheck];e&&this.logger.diagnostics.disabledDueToMetaLandingPageAndMemberRate(e),this.messagePerType[s.priceCheck]=void 0}ii({messagePerType:this.messagePerType,apiKey:t.key,trackingEnrichment:i});for(const e of Object.values(this.messagePerType))this.logger.diagnostics.shouldShow(e);const C=new Zi(this.logger,u,e,this.messagePerType,this.notifications);this.addNonPriceDataWidgetIframes(C);Object.entries(this.messagePerType).filter((([e,t])=>!!t&&(e===s.undercut||e===s.priceCheck||e===s.inPage&&t.content.type===k.PriceCheck))).map((([,e])=>e)).length&&await this.handleMessagesThatRequirePricingData(e,C,t);Object.entries(this.widgetIframes).filter((([,e])=>!!e)).map((([e])=>e)).length||this.logger.info("Found no messages to use")}catch(e){this.logger.error(e)}finally{this.logger.diagnostics.flush()}}async handlePreviewMessage(e=Ae,t=this.externalState){this.logger.info("Previewing message");const i=this.getPreviewMessageId(t);if(i&&t?.clientName&&(t.apiKey||t.clientKey)){const a=await oa({messageId:i,client:t?.clientName,apiKey:t.apiKey||t.clientKey,language:t.language,config:e,logger:this.logger});if(!a)return;this.messagePerType={[a.type]:Qt(a)};const r=new Zi(this.logger,{isMobile:this.isMobile},t,this.messagePerType,this.notifications,void 0);this.addNonPriceDataWidgetIframes(r),this.pricingData=ca(t,a.type),this.handlePriceCheckData({pricingData:this.pricingData,widgetLoader:r,calledMetaApi:!1,currentPage:t?.pageType}),this.widgetIframes[s.previewAssist]=r.loadPreviewAssist()}else this.logger.error(`Could not get message id, clientName or one of clientKey or apiKey, page url ${t.pageUrl}`)}async handleMessagesThatRequirePricingData(e,t,i){if(this.messagePerType[s.undercut]&&this.messagePerType[s.undercut]?.criteria?.metaParityStatus&&this.messagePerType[s.undercut]?.content.ctaType===S.CopyOnClick&&this.messagePerType[s.undercut]?.content.copy.ctaPromoCode&&yt(e.pageUrl))return void await this.getMetaParityForUndercut(i,e,t);const a=await this.getPriceMatchConfig(e.pageUrl,e.priceCheckData,e.apiKey);if(a){this.currentPriceCheckController&&this.currentPriceCheckController.abort(),this.currentPriceCheckController=new AbortController;const r=await this.priceCheckWithPriceMatchApi.getPriceMatchData(i,e,a.otas);return this.logger.info("Price Match Data",r),void(this.currentPriceCheckController?.signal.aborted?this.logger.info("MessageController: Ignoring price match data - request was aborted"):(this.logger.info("MessageController: Processing price match data - not aborted"),this.handlePriceCheckData({pricingData:r?.pricingData,priceMatchData:r,widgetLoader:t,calledMetaApi:!1,currentPage:e.pageType})))}this.currentPriceCheckController&&(this.logger.info("MessageController: Aborting existing price check request"),this.currentPriceCheckController.abort()),this.currentPriceCheckController=new AbortController,this.logger.info("MessageController: Created new AbortController for price check request"),this.startTimePricingData=window.performance.now(),this.pricingApi.getPricingData(i,e,(i=>{this.currentPriceCheckController?.signal.aborted?this.logger.info("MessageController: Ignoring pricing data from callback - request was aborted"):(this.logger.info("MessageController: Processing pricing data from callback - not aborted"),this.handlePriceCheckData({pricingData:i,widgetLoader:t,calledMetaApi:!1,currentPage:e.pageType}))}),this.currentPriceCheckController.signal)}templatePriceMatchCopy(){const e=this.messagePerType[s.priceCheck];this.isPriceMatchPriceCheck(e)&&this.priceMatchResponse?.discountedPrice.percentage&&(this.messagePerType[s.priceCheck]={...e,content:{...e?.content,copy:{...e?.content.copy,applyDiscount:e.content.copy.applyDiscount.replace("5",this.priceMatchResponse?.discountedPrice.percentage.toString())}}})}isPriceMatchPriceCheck(e){return void 0!==e.content.copy.applyDiscount}handlePriceCheckData({pricingData:e,priceMatchData:t,widgetLoader:i,calledMetaApi:a,currentPage:r}){if(this.logger.info("Incoming pricing data",{pricingData:e}),n=t,Boolean(n&&"priceMatchResponse"in n)&&!this.widgetIframes[s.priceCheck]&&r===K.RoomsAndRates)return this.pricingData=t.pricingData,this.priceMatchResponse=t.priceMatchResponse,this.templatePriceMatchCopy(),void(this.widgetIframes[s.priceCheck]=i.loadPriceCheckWithPriceMatch());var n;this.pricingData=e,a||!e||e.pricingScenario!==Ki.allUndercut||this.widgetIframes[s.undercut]||(this.widgetIframes[s.undercut]=i.loadUndercut(!1,this.pricingData)),e&&e.pricingScenario===Ki.bestDirect&&!this.widgetIframes[s.priceCheck]&&r===K.RoomsAndRates&&(this.widgetIframes[s.priceCheck]=i.loadPriceCheck(this.pricingData)),e&&e.pricingScenario===Ki.bestDirect&&!this.widgetIframes[s.inPage]&&(this.widgetIframes[s.inPage]=i.loadInPage(this.pricingData)),e&&e.pricingScenario!==Ki.unknown&&this.sendDataToAllWidgets(p.incomingPricingData,{pricingData:e})}async getMetaParityForUndercut(e,t,i){const a=await this.metaParityApi.getMetaParityData(t,this.messagePerType[s.undercut]?.id);this.logger.info("Received response for meta pricing data",{metaParityData:a}),a&&a.data.status===N.UNDERCUT?this.widgetIframes[s.undercut]=i.loadUndercut(!0):(this.currentPriceCheckController&&(this.logger.info("MessageController: Aborting existing price check request (price match flow)"),this.currentPriceCheckController.abort()),this.currentPriceCheckController=new AbortController,this.logger.info("MessageController: Created new AbortController for price match request"),this.pricingApi.getPricingData(e,t,(e=>{this.currentPriceCheckController?.signal.aborted?this.logger.info("MessageController: Ignoring pricing data from meta fallback callback - request was aborted"):(this.logger.info("MessageController: Processing pricing data from meta fallback callback - not aborted"),this.handlePriceCheckData({pricingData:e,widgetLoader:i,calledMetaApi:!0,currentPage:t.pageType}))}),this.currentPriceCheckController.signal))}async createLocalStorage(){if(!this.localStorage){const e=await new Promise((e=>{const t=document.createElement("iframe");t.onload=()=>{e(t)},t.src=Ae.storageIframeSrc,t.title="blank",t.setAttribute("aria-hidden","true"),t.setAttribute("style","display: none; height: 0; width: 0;"),document.body.appendChild(t)}));this.localStorage=new Be(e,window)}return this.localStorage}async getPriceMatchConfig(e,t,i){const a=e=>this.logger.info(`Price Match Config not fetched: ${e}`);if(!t||!i)return void a("Missing priceCheckData or apiKey");if(ga(e))return void a("Is meta price match");if(ua(e))return{otas:pa};const r=await this.priceMatchConfig.get({apiKey:i});return r&&!1!==r.isEnabled?{otas:r.otas}:void 0}}(Ta,Pa,xa,Da,Ia);new class{constructor(e,t){this.logger=e,this.messageController=t,this.logger.info("Init Bootstrap Message Engine"),this.logger.info("VERSION","20250827080428"),this.logger.info("COMMIT_HASH","60017a80b06ff51ba8ceaa75823487136ad67436"),window.addEventListener("message",this.onTripteaseConfigMessage)}onTripteaseConfigMessage=e=>{try{e.data&&e.data.type===re.Config&&(this.logger.info("Received triptease config update:",e.data),this.tryToRun(e.data))}catch(e){this.logger.error(e)}};tryToRun(e){const t=Le(e);if(!t)return;const i=de(t,this.previousExternalState),a=oe(t,this.logger);i&&a&&(this.externalState=t,this.actuallyRun())}actuallyRun(){if(!this.externalState)return;const e=pe(this.externalState);if(this.previousExternalState&&this.previousExternalState.clientKey&&!this.previousExternalState.apiKey&&this.externalState.apiKey&&this.externalState.pageUrl===this.previousExternalState.pageUrl){const t=new Re(this.externalState,e),i={eventAppName:ie.messageEngine,eventName:ee.events,event:"api_key_change_on_same_page"};t.track(i)}this.previousExternalState=this.externalState,this.messageController.loadsChoosesDisplaysMessages(this.externalState,e)}}(Ta,_a)})();